【1085】Holding Bin-Laden Captive!
作者:互联网
1085
母函数。
#include<bits/stdc++.h>
using namespace std;
int c1[6000],c2[6000];
int main(){
int i,j;
int a,b,c;
while(1){
scanf("%d%d%d",&a,&b,&c);
int sum=a+2*b+5*c;
if(a==0&&b==0&&c==0&&sum==0)break;
memset(c1,0,sizeof(c1));
memset(c2,0,sizeof(c2));
for(i=0;i<=a;i++){
c1[i]=1;
}
for(i=0;i<=a;i++){
for(j=0;j<=2*b;j+=2){
c2[i+j]+=c1[i];
}
}
memset(c1,0,sizeof(c1));
for(i=0;i<=a+2*b;i++){
for(j=0;j<=c*5;j+=5){
c1[i+j]+=c2[i];
}
}
for(i=0;i<=sum;i++){
if(c1[i]==0){
printf("%d\n",i);
break;
}
}
if(i==sum+1)printf("%d\n",sum+1);
}
return 0;
}
标签:Bin,1085,int,sum,memset,Captive,c2,c1,sizeof 来源: https://blog.csdn.net/weixin_49646622/article/details/119301938