結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2022-06-11 15:44:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 364 bytes |
コンパイル時間 | 786 ms |
コンパイル使用メモリ | 74,324 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-22 02:35:13 |
合計ジャッジ時間 | 2,024 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int L,N; cin >> L >> N; vector<int> W(N); for(int i=0;i<N;++i){ cin >> W[i]; } sort(W.begin(),W.end()); int ans = 0; for(int i=0;i<N;++i){ L -= W[i]; if(L>0){ ans++; }else{ break; } } cout << ans << endl; return 0; }