Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*-----------------
- * author: Rainboy
- * email: rainboylvx@qq.com
- * time: 2019年 05月 19日 星期日 17:06:26 CST
- * problem: luogu-2347
- *----------------*/
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- using namespace std;
- int a[10];
- int f[1005] = {0};
- int w[10] = {0,1,2,3,5,10,20};
- int main(){
- int i,j,k;
- for (i=1;i<=6;i++){
- scanf("%d",&a[i]);
- }
- f[0] =1;
- int cnt = 0;
- for(i=1;i<=6;i++)
- for(j=1;j<=a[i];j++){
- for(k=1000;k>=w[i];k--){
- if( f[k] == 0 && f[k-w[i]] ==1){
- f[k] = 1;
- cnt++;
- }
- }
- }
- printf("Total=%d\n",cnt);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement