标签:des style blog http color java os strong
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2709 Accepted Submission(s): 1811
1 #include<cstdio> 2 #include<cstring> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 int a[1000000]; 7 int dp[1000000]; 8 int main() 9 { 10 int n,m; 11 while(scanf("%d %d",&n,&m)!=EOF) 12 { 13 memset(dp,0,sizeof(dp)); 14 for(int i=0;i<n;i++) 15 scanf("%d",&a[i]); 16 for(int i=0;i<n;i++) 17 for(int j=a[i];j<=m;j++) 18 dp[j]=max(dp[j],dp[j-a[i]]+1); 19 printf("%d\n",dp[m]); 20 } 21 return 0; 22 }
HDU Flowers 完全背包,布布扣,bubuko.com
标签:des style blog http color java os strong
原文地址:http://www.cnblogs.com/clliff/p/3888900.html