一道母函数的题:点击打开链接
代码:
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<iomanip>
#include<queue>
using namespace std;
int c1[8100],c2[8002];
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
int n1,n2,n5;
while(cin>>n1>>n2>>n5){
if(n1==0&&n2==0&&n5==0)
break;
memset(c1,0,sizeof(c1));
memset(c2,0,sizeof(c2));
for(int i=0;i<=n1;++i){
c1[i]=1;
}
for(int i=0;i<=n1;i++)
for(int j=0;j<=2*n2;j+=2){
c2[i+j]+=c1[i];
}
memset(c1,0,sizeof(c1));
for(int i=0;i<=n1+2*n2;++i)
for(int j=0;j<=5*n5;j+=5){
c1[i+j]+=c2[i];
}
for(int i=1;;++i){
if(c1[i]==0)
{cout<<i<<endl;
break;}
}
}
return 0;
}