結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2015-08-25 13:28:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 306 bytes |
コンパイル時間 | 395 ms |
コンパイル使用メモリ | 58,532 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 07:32:29 |
合計ジャッジ時間 | 1,202 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
#include <iostream> #include <algorithm> int l, n; int w[10001]; int main(){ std::cin >> l >> n; for (int i = 0; i < n; ++i)std::cin >> w[i]; std::sort(w, w + n); int cnt = 0; for (int i = 0; i < n; ++i){ if (l < w[i])break; else l -= w[i], ++cnt; } std::cout << cnt << std::endl; return 0; }