結果
問題 |
No.5 数字のブロック
|
ユーザー |
|
提出日時 | 2016-10-22 18:09:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 339 bytes |
コンパイル時間 | 598 ms |
コンパイル使用メモリ | 62,204 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-23 17:16:44 |
合計ジャッジ時間 | 1,563 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 WA * 7 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main() { int L, N, i, result = 0; int *W; cin >> L >> N; W = new int[N+1]; for (i = 0; i < N; i++) { cin >> W[i]; } W[N] = 1; stable_sort(W, W + N); i = 0; while (result <= L) { result += W[i]; i++; } cout << i-1 << endl; delete[] W; return 0; }