結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2018-06-01 10:39:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 529 ms |
コンパイル使用メモリ | 65,300 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 08:47:11 |
合計ジャッジ時間 | 1,780 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> int main(int argc, char** argv) { int L, N; std::cin >> L >> N; std::vector<int> w(N); for (int i = 0; i < N; ++i) { std::cin >> w[i]; } std::sort(w.begin(), w.end()); int sum = 0; for (int i = 0; i < N; ++i) { if (sum + w[i] > L) { std::cout << i; break; } sum += w[i]; } return 0; }