結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2015-06-24 23:09:34 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 342 bytes |
コンパイル時間 | 1,472 ms |
コンパイル使用メモリ | 162,212 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 17:30:37 |
合計ジャッジ時間 | 2,660 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <bits/stdc++.h> #define FOR(I,A,B) for(int I=A;I<B;I++) #define ALL(C) C.begin(), C.end() using namespace std; int main() { int L, N; cin >> L >> N; vector<int> W(N); FOR(i,0,N) cin >> W[i]; sort(ALL(W)); int a=0; int s=0; FOR(i,0,N) { s+=W[i]; if ( s >= L ) break; a++; } cout << a << endl; return EXIT_SUCCESS; }