题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1085
思路:模板题
#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; const ll inff = 0x3f3f3f3f3f3f3f3f; #define FOR(i,a,b) for(int i(a);i<=(b);++i) #define FOL(i,a,b) for(int i(a);i>=(b);--i) #define REW(a,b) memset(a,b,sizeof(a)) #define inf int(0x3f3f3f3f) #define si(a) scanf("%d",&a) #define sl(a) scanf("%I64d",&a) #define sd(a) scanf("%lf",&a) #define ss(a) scanf("%s",a) #define mod int(1e9+7) #define pb push_back #define lc (d<<1) #define Pll pair #define P pair #define pi acos(-1) int c1[18008],c2[18008],num[3],cost[3]={1,2,5},MAX; void init() { c1[0]=1; FOR(i,0,2) { for(int j=0;j<=MAX;j++) { for(int k=0;k<=num[i]*cost[i];k+=cost[i]) { c2[j+k]+=c1[j]; } } FOR(j,0,10000) c1[j]=c2[j],c2[j]=0; } } int main() { cin.tie(0); cout.tie(0); while(cin>>num[0]>>num[1]>>num[2]&&(num[0]+num[1]+num[2])) { REW(c1,0),REW(c2,0); MAX=num[0]+2*num[1]+5*num[2]; init(); FOR(i,0,10000) { if(!c1[i]) { cout<