Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
Register

## Re:v开[14000]能过 [13000]都过不了.. 为什么

Posted by 478466286 at 2014-06-03 14:37:03 on Problem 3624
In Reply To:v开[14000]能过 [13000]都过不了.. 为什么 Posted by:Viaxl at 2010-01-27 16:57:18
```> #include <cstdio>
> #include <cstring>
> #define max(x,y) (x>y?x:y)
>
> int main() {
>     int n,V,w[4403],c[4403],v[14000],count_w,from;
>
>     ///initialize
>     memset(v,0,14000);
>     count_w=0;
>
>     scanf("%d %d",&n,&V);
>     for(int i=1;i<=n;i++) {
>         scanf("%d %d",w+i,c+i);
>         count_w+=w[i];
>     }
>
>     from=V-count_w;
>
>     for(int i=1;i<=n;i++) {
>         from+=w[i];
>         for(int j=V;j>=max(w[i],from);j--)
>         ///zeroOnePack();
>         v[j]=max(v[j],v[j-w[i]]+c[i]);
>     }
>     printf("%d\n",v[V]);
>     return 0;
> }
```

Followed by: