标签:
1 /*
2 比C还水。。。
3 */
4 #include <cstdio>
5 #include <algorithm>
6 #include <cstring>
7 #include <cmath>
8 #include <iostream>
9 using namespace std;
10
11 typedef long long ll;
12
13 const int MAXN = 1e5 + 10;
14 const int INF = 0x3f3f3f3f;
15 ll a[MAXN];
16
17 int main(void) //Codeforces Round #303 (Div. 2) D. Queue
18 {
19 //freopen ("D.in", "r", stdin);
20
21 int n;
22 while (scanf ("%d", &n) == 1)
23 {
24 for (int i=1; i<=n; ++i) scanf ("%I64d", &a[i]);
25 sort (a+1, a+1+n);
26 ll sum = 0; int cnt = 0; a[0] = 0;
27 for (int i=1; i<=n; ++i)
28 {
29 if (sum <= a[i])
30 {
31 sum += a[i]; cnt++;
32 }
33 }
34
35 printf ("%d\n", cnt);
36 }
37
38 return 0;
39 }
水题 Codeforces Round #303 (Div. 2) D. Queue
标签:
原文地址:http://www.cnblogs.com/Running-Time/p/4520918.html