
母函数
南山小翁
活在当下,要有思想,每个人不是随随便便就能成功!
展开
-
hdu1398 母函数
给你一个数 让你求出1~17中每个数的平方任意组合 有几种情况满足条件。#include#include#define max 302int num1[300];int num2[300];void init(){ for(int i=0; i<max; i++) { num1[i]=1; num2[i]=0; }原创 2012-10-21 09:44:39 · 1428 阅读 · 1 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=2110
#include#include#define max 10001int c1[max],c2[max];int main(){ int sumTest; int pi[101],mi[101]; while(scanf("%d",&sumTest),sumTest) { int sumNum=0; for(int i=0;原创 2012-11-07 07:47:35 · 617 阅读 · 0 评论 -
hdu 1085 http://acm.hdu.edu.cn/showproblem.php?pid=1085
#include#include#define max 8010int c1[max],c2[max];//c1和c2的坐标代表指数的大小 c1与c2里面存的是该指数的系数。int main()//c1存的是前一个多项式的属性 c2存的是后一个多项式的属性 需要不断更新 模拟多项式的乘法运算。{ int num[4]; int sumNum; i原创 2012-11-07 09:13:53 · 550 阅读 · 0 评论 -
hdu1171 http://acm.hdu.edu.cn/showproblem.php?pid=1171
//给你每中物品的价值 和 该物品的数量 让你尽量把它们的总价值平均分配。//注意细节 用母函数容易超时 注意 step sumMoney 以及 value*fac个代表的含义 step代表前一个数列式子的个数 sumMoney最大的指数 value*fac当前总价值#include#include#define max 250003int c1[max],c2[max];in原创 2012-11-07 16:28:11 · 598 阅读 · 0 评论 -
hdu 2079http://acm.hdu.edu.cn/showproblem.php?pid=2079
//题意很容易理解 在这里不解释了#include#include#define max 700int c1[max],c2[max];int main(){ int a,b; int va,vb; int T; scanf("%d",&T); for(int i=0; i<T; i++) { memset(c1,0,si原创 2012-11-07 19:14:08 · 576 阅读 · 0 评论 -
hdu2082 http://acm.hdu.edu.cn/showproblem.php?pid=2082
#include#include#define max 100int c1[max],c2[max];int chaNum[27];void start(){ for(int i=1; i<=26; i++) { chaNum[i]=i; }}int main(){ int T; int ans; scanf("%d原创 2012-11-08 11:48:24 · 516 阅读 · 0 评论 -
hdu 2189 http://acm.hdu.edu.cn/showproblem.php?pid=2189
#include#include#include#define max 155int c1[max],c2[max];int if_prime[max];void get_prime(){ for(int i=2; i<=(int)sqrt(max); i++) if(if_prime[i]==0) for(int j=i*i; j<=原创 2012-11-08 17:53:46 · 600 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1028
题意:给你一个整数N,求出有多少种组合情况,满足M(M>=1)个整数的和为N.每种情况是有限个k*i+j;#include#include#define max 130int c1[max],c2[max];void init(){ memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); c1[0]=1; f原创 2013-02-21 11:58:21 · 549 阅读 · 0 评论 -
http://acm.hdu.edu.cn/showproblem.php?pid=1709
//题意:一个天平,若干个砝码,问在秤取这个范围[1,S](S为最大的重量)时,求不能秤取得重量。天平的两端可以同时放砝码。#include#include#include#define max 100001int c1[max],c2[max];int abs(int a){ if(a<0) return -a; else return a原创 2013-02-22 15:24:59 · 487 阅读 · 0 评论