http://acm.hdu.edu.cn/showproblem.php?pid=4104
鉴定完毕: 果然是个大水题,想当时我还是用dp水过的
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn=1010;
int a[maxn];
int main()
{
int n;
while(scanf("%d",&n)==1)
{
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
long long sum=0;
for(int i=0;i<n;i++)
{
if(a[i]>sum+1) break;
sum+=a[i];
}
printf("%d\n",sum+1);
}
return 0;
}

183

被折叠的 条评论
为什么被折叠?



