| 比赛 | 20160420s | 评测结果 | MMMMMMMMMM |
|---|---|---|---|
| 题目名称 | 买汽水 | 最终得分 | 0 |
| 用户昵称 | 哒哒哒哒哒! | 运行时间 | 0.014 s |
| 代码语言 | C++ | 内存使用 | 0.00 MiB |
| 提交时间 | 2016-04-20 08:47:53 | ||
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
int f[100000010];
int main()
{
freopen("drink.in","r",stdin);
freopen("drink.out","w",stdout);
int n,max_v;
scanf("%d%d",&n,&max_v);
for(int i=1;i<=n;i++){
int x;
scanf("%d",&x);
if(x<max_v){
for(int j=max_v;j>=x;j--){
f[j]=max(f[j],f[j-x]+x);
}
}
}
printf("%d",f[max_v]);
return 0;
}