HDU 1864 01 Backpack,

Source: Internet
Author: User

The problem test instructions a bit of a hole, feeling particularly vague,

I began to have a little understanding, that is, the reimbursement of the entire cheque is reimbursed, but also I am stupid, no common sense

Another point is that the total amount of a single cheque is not more than 1000, each cheque in the total amount of not more than 600, I began to think that the problem is the data will give, did not expect to own judgment

And do not meet the conditions of the cheque to go directly to the 、--、 can only blame themselves to do less, nothing or a good brush, even if others give up I do not allow themselves to give up

The input data for this question are all 2 decimal places and can be processed directly into integers

And then it's the bare 01 backpack.

1#include <iostream>2#include <cstdio>3#include <cstring>4#include <algorithm>5 using namespacestd;6 Const intqq=5000000+ -;7 intDP[QQ];8 intP[QQ];9 intMain ()Ten { One     Doubletot; A     intN; -      while(~SCANF ("%lf%d", &tot,&n) &&N) { -Memset (DP,0,sizeof(DP)); the         intSum= (int) (tot* -); -     //printf ("%d\n", sum); -         intCount=0, M; -         Doublex; +         Chars; -          for(intI=0; i<n;++i) { +scanf"%d",&m); A             intA,b,c,flag; atA=b=c=0; -flag=1; -              for(intj=0; j<m;++j) { -scanf"%*C%C%*C%LF",&s,&x); -                 intY= (int) (x* -); -                 if(s=='A') a+=y; in                 Else if(s=='B') b+=y; -                 Else if(s=='C') c+=y; to                 Elseflag=0; +             } -             if(A+b+c<=1e5 && a<=60000&& b<=60000&& c<=60000&&flag) thep[count++]=a+b+C; *         } $          for(intI=0; i<count;++i)Panax Notoginseng              for(intj=sum;j>=p[i];--j) -Dp[j]=max (dp[j],dp[j-p[i]]+p[i]); theprintf"%.2lf\n", dp[sum]*1.0/ -); +     } A     return 0; the}

HDU 1864 01 Backpack,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.