标签:str while cin return last pac ++ namespace clu
#include <iostream>
#include <cstring>
using namespace std;
int n[3],a[9000],b[9000],i,j,k,last,last2;
int v[3]={1,2,5};
int main()
{
while ((cin>>n[0]>>n[1]>>n[2])&&(n[0]!=0||n[1]!=0|n[2]!=0))
{
a[0]=1;
last=0;
for (i=0;i<=2;i++)
{
last2=last+n[i]*v[i];
memset(b,0,sizeof(int)*(last2+1));
for (j=0;j<=n[i];j++)
for (k=0;k<=last;k++)
b[k+j*v[i]]+=a[k];
memcpy(a,b,sizeof(int)*(last2+1));
last=last2;
}
for (i=0;i<=last;i++)
if (a[i]==0)
break;
cout<<i<<endl;
}
return 0;
}
标签:str while cin return last pac ++ namespace clu
原文地址:http://www.cnblogs.com/wangkun1993/p/6341662.html