#include<stdio.h>
#include<string.h>
int main()
{
int c1[15001],c2[15001],c3[15001];
int n1,n2,n3;
int i,j,k,f;
while(scanf("%d%d%d",&n1,&n2,&n3)!=EOF && (n1||n2||n3) )
{
memset(c1,0,sizeof(c1));
memset(c2,0,sizeof(c2));
memset(c3,0,sizeof(c3));
for(i=0;i<=n1;i++)
c1[i]=1;
for(j=0;j<=n1;j++)
for(k=0;k<=2*n2;k+=2)
c2[j+k]+=c1[j];
for(j=0;j<=n1+2*n2;j++)
for(k=0;k<=5*n3;k+=5)
c3[j+k]+=c2[j];
f=0;
for(j=0;j<=n1+2*n2+5*n3;j++)
if(c3[j]==0)
{
printf("%d\n",j);
f=1;
break;
}
if(!f)
printf("%d\n",n1+2*n2+5*n3+1);
}
return 0;
}
hdu 1085 之母函数探索变形
最新推荐文章于 2021-02-12 22:05:40 发布