标签:
简单的母函数应用。
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<algorithm> #include<stack> #include<queue> #include<cctype> #include<sstream> using namespace std; #define pii pair<int,int> #define LL long long int const double eps=1e-10; const int INF=1000000000; const int maxn=8000+10; int c1[maxn],n1,n2,n5; int main() { //freopen("in1.txt","r",stdin); //freopen("out.txt","w",stdout); while(~scanf("%d%d%d",&n1,&n2,&n5)) { if(n1==0&&n2==0&&n5==0) break; memset(c1,0,sizeof(c1)); for(int i=0; i<=n1; i++)//第一个括号 { c1[i]=1; } //第二个括号 for(int j=0; j<=n1; j++) { for(int k=0; k<=2*n2; k+=2) { c1[k+j]=1; //cout<<k+j<<endl; } } //第三个括号 for(int j=0;j<=n1+2*n2;j++) { for(int k=0;k<=5*n5;k+=5) { if(c1[j]) { c1[j+k]=1; } } } for(int i=0;; i++) { if(c1[i]==0) { printf("%d\n",i); break; } } } return 0; }
hdu1085 Holding Bin-Laden Captive!(母函数)
标签:
原文地址:http://www.cnblogs.com/zywscq/p/4275437.html