2013
12-13

# 九度-1531-货币面值[解题代码]

5
1 2 3 9 100
5
1 2 4 9 100
5
1 2 4 7 100

7
8
15

cpp 代码如下：
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int a[110],n;
while(scanf("%d",&n) != EOF) {
for(int i = 1; i <= n; i ++)
scanf("%d",&a[i]);
a[0] = 0;
sort(a + 1,a + n + 1);
int ans = 0;
for(int i = 1; i <= n; i ++)
if(a[i] > ans + 1) {
break;
}
else ans += a[i];
printf("%d\n",ans + 1);
}
return 0;
}

/**************************************************************
Problem: 1531
User: coder
Language: C++
Result: Accepted
Time:10 ms
Memory:1520 kb
****************************************************************/

1. Good task for the group. Hold it up for every yeara??s winner. This is a excellent oppotunity for a lot more enhancement. Indeed, obtaining far better and much better is constantly the crucial. Just like my pal suggests on the truth about ab muscles, he just keeps obtaining much better.