编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#45724 | #1020. jwp的采购之旅 | Compile Error | 0 | 0 ms | 0 K | C++ / 343 B | 经济99-刘雨泽 | 2020-08-05 9:17:05 |
#include <iostream>
using namespace std;
int a[100001];
int main() {
int n, m;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
sort(a, a + n);
int j = 0;
for (int i = 0; i < n; i++) {
m -= a[i];
j++;
if (m <= 0)
break;
}
cout << j--;
return 0;
}
编译信息
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:6:5: error: 'scanf' was not declared in this scope
scanf("%d%d",&n,&m);
^~~~~
/sandbox/1/a.cpp:6:5: note: suggested alternative: 'wscanf'
scanf("%d%d",&n,&m);
^~~~~
wscanf
/sandbox/1/a.cpp:9:5: error: 'sort' was not declared in this scope
sort(a,a+n);
^~~~
/sandbox/1/a.cpp:9:5: note: suggested alternative: 'short'
sort(a,a+n);
^~~~
short