编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22820 | #1020. jwp的采购之旅 | Compile Error | 0 | 0 ms | 0 K | C++ 11 / 296 B | Albot | 2020-02-14 22:35:52 |
#include <bits/stdc++.h>
uisng namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(a.begin(), a.end());
int count = 0;
while (m > 0) {
m -= a[count++];
}
cout << count << endl;
}
编译信息
/sandbox/1/a.cpp:2:1: error: 'uisng' does not name a type; did you mean 'uint'?
uisng namespace std;
^~~~~
uint
/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:5:5: error: 'cin' was not declared in this scope
cin>>n>>m;
^~~
/sandbox/1/a.cpp:5:5: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/8/x32/bits/stdc++.h:75,
from /sandbox/1/a.cpp:1:
/usr/include/c++/8/iostream:60:18: note: 'std::cin'
extern istream cin; /// Linked to standard input
^~~
/sandbox/1/a.cpp:6:5: error: 'vector' was not declared in this scope
vector<int> arr(n);
^~~~~~
/sandbox/1/a.cpp:6:5: note: suggested alternative:
In file included from /usr/include/c++/8/vector:64,
from /usr/include/c++/8/queue:61,
from /usr/include/x86_64-linux-gnu/c++/8/x32/bits/stdc++.h:86,
from /sandbox/1/a.cpp:1:
/usr/include/c++/8/bits/stl_vector.h:339:11: note: 'std::vector'
class vector : protected _Vector_base<_Tp, _Alloc>
^~~~~~
/sandbox/1/a.cpp:6:12: error: expected primary-expression before 'int'
vector<int> arr(n);
^~~
/sandbox/1/a.cpp:8:14: error: 'arr' was not declared in this scope
cin>>arr[i];
^~~
/sandbox/1/a.cpp:10:10: error: 'a' was not declared in this scope
sort(a.begin(),a.end());
^
/sandbox/1/a.cpp:10:5: error: 'sort' was not declared in this scope
sort(a.begin(),a.end());
^~~~
/sandbox/1/a.cpp:10:5: note: suggested alternative:
In file included from /usr/include/c++/8/algorithm:62,
from /usr/include/x86_64-linux-gnu/c++/8/x32/bits/stdc++.h:65,
from /sandbox/1/a.cpp:1:
/usr/include/c++/8/bits/stl_algo.h:4854:5: note: 'std::sort'
sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
^~~~
/sandbox/1/a.cpp:15:5: error: 'cout' was not declared in this scope
cout<<count<<endl;
^~~~
/sandbox/1/a.cpp:15:5: note: suggested alternative:
In file included from /usr/include/x86_64-linux-gnu/c++/8/x32/bits/stdc++.h:75,
from /sandbox/1/a.cpp:1:
/usr/include/c++/8/iostream:61:18: note: 'std::cout'
extern ostream cout; /// Linked to standard output
^~~~
/sandbox/1/a.cpp:15:18: error: 'endl' was not declared in this scope
cout<<count<<endl;
^~~~
/sandbox/1/a.cpp:15:18: note: suggested alternative:
In file included from /usr/include/c++/8/istream:39,
from /usr/include/c++/8/sstream:38,
from /usr/include/c++/8/complex:45,
from /usr/include/c++/8/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/8/x32/bits/stdc++.h:52,
from /sandbox/1/a.cpp:1:
/usr/include/c++/8/ostream:590:5: note: 'std::endl'
endl(basic_ostream<_CharT, _Traits>& __os)
^~~~