結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2016-04-04 22:00:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 449 bytes |
コンパイル時間 | 827 ms |
コンパイル使用メモリ | 64,436 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-04 00:58:58 |
合計ジャッジ時間 | 1,789 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); int L, N, ans=0; 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(), std::less<int>()); while(true){ L -= W[ans]; if(L<0) break; ++ans; } std::cout << ans << "\n"; return 0; }