結果
問題 | No.5 数字のブロック |
ユーザー |
|
提出日時 | 2017-11-24 10:52:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 410 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 75,440 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 11:50:32 |
合計ジャッジ時間 | 1,537 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int w, n; cin >> w >> n; vector<int> vc(n); for(auto &x : vc){ cin >> x; } sort(vc.begin(),vc.end()); int count{0}, res{0}; for(auto x : vc){ res += x; if(res <= w){ count++; } } cout << count << endl; return 0; }