結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2017-12-22 20:11:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 379 bytes |
コンパイル時間 | 836 ms |
コンパイル使用メモリ | 63,788 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-17 23:15:44 |
合計ジャッジ時間 | 1,769 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int L, N; vector<int> w(10000); cin >> L >> N; for(int i=0; i<N; i++){ cin >> w[i]; } sort(w.begin(), w.begin()+N); int num, sum=0; for(num=0; num<N; num++){ if(sum+w[num]<L) sum+=w[num]; else break; } cout << num; return 0; }