49517 10381
510
632
628
973
286
555
454
346
928
161
788
218
768
536
928
51
799
376
<242050 bytes omitted>
用户输出
1007
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#23747 | #1020. jwp的采购之旅 | Accepted | 100 | 50 ms | 704 K | C++ 17 / 425 B | 电类944-李泊宇 | 2020-02-17 14:54:44 |
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define ios \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
int n, m;
int s, cnt, num;
int list[100006];
int main() {
cin >> n >> m;
rep(i, 0, n - 1) { cin >> list[i]; }
s = 0;
sort(list, list + n);
rep(i, 0, n - 1) {
s = s + list[i];
if (s > m)
break;
cnt++;
}
cout << cnt;
}
49517 10381
510
632
628
973
286
555
454
346
928
161
788
218
768
536
928
51
799
376
<242050 bytes omitted>
用户输出
1007
系统信息
Exited with return code 0
10275 688001
248
7
829
41
135
305
833
20
238
562
122
705
44
566
959
252
837
828
2
<50105 bytes omitted>
用户输出
3824
系统信息
Exited with return code 0
99537 230761
617
79
429
959
175
563
23
857
892
30
557
449
298
197
975
469
123
54
<486854 bytes omitted>
用户输出
6769
系统信息
Exited with return code 0
32687 937376
986
151
30
876
983
54
213
694
547
730
224
193
320
597
991
454
642
280
<159779 bytes omitted>
用户输出
7831
系统信息
Exited with return code 0