标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 19908 Accepted Submission(s): 8865
#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int c1[10000]; int c2[10000]; int c3[4000]; int main() { int a,b,c; while(scanf("%d%d%d",&a,&b,&c)!=EOF&&(a||b||c)) { memset(c1,0,sizeof(c1)); memset(c2,0,sizeof(c2)); memset(c3,0,sizeof(c3)); for(int i=0; i<=a; i++) c1[i]=1; for(int i=0; i<=a; i++) for(int j=0; j<=2*b; j+=2) c2[i+j]+=c1[i]; for(int i=0;i<=a+b*2;i++) { c1[i]=c2[i]; c2[i]=0; } for(int i=0; i<=(a*1)+(b*2); i++) for(int j=0; j<=5*c; j+=5) c2[i+j]+=c1[i]; for(int i=0;i<=a+b*2+c*5;i++) c1[i]=c2[i]; /*for(int i=0;i<=a+2*b+5*c;i++) cout<<c1[i]<<endl; cout<<endl;*/ for(int i=1;i<=a+2*b+5*c+1;i++) if(c1[i]==0) { printf("%d\n",i); break; } } return 0; }
HDU_1085_Holding Bin-Laden Captive!_母函数
标签:
原文地址:http://www.cnblogs.com/jasonlixuetao/p/5537903.html