标签:blog os io for div amp log size
想来想去都有bug 最后简单粗暴的一个一个来处理了
#include<stdio.h> #include<string.h> #include<math.h> #include<iostream> #include<algorithm> #include<queue> #include<stack> #define mem(a,b) memset(a,b,sizeof(a)) #define ll __int64 #define MAXN 1000 #define INF 0x7ffffff #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 int num[10000]; using namespace std; int main() { int n1,n2,n5; int i,j,flag,ans; while(scanf("%d%d%d",&n1,&n2,&n5)!=EOF) { if(n1==0&&n2==0&&n5==0) break; mem(num,-1); num[0]=0; flag=0; ans=0; int m=n1+n2*2+n5*5; //最大8000 int cnt=n1+n2+n5; //最大3000 while(cnt--) { if(n1) {flag=1;n1--;} else if(n2){flag=2;n2--;} else if(n5){flag=5;n5--;} for(i=m;i>=0;i--) { if(num[i]==0) { num[i+flag]=0; } } } for(i=0;i<=100000;i++) { //cout<<i<<" "<<num[i]<<endl; if(num[i]==-1) { ans=i;break; } } cout<<ans<<endl; } return 0; }
标签:blog os io for div amp log size
原文地址:http://www.cnblogs.com/sola1994/p/3915909.html