結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-01-18 10:57:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 291 bytes |
| コンパイル時間 | 488 ms |
| コンパイル使用メモリ | 59,228 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 00:55:01 |
| 合計ジャッジ時間 | 1,644 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 14 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int L, N, W[10000], sum = 0, ans = 0;
cin >> L >> N;
for(int i=0; i<N; i++) cin >> W[i];
sort(W, W+N);
while(sum+W[ans]<L) {
sum += W[ans];
ans++;
}
cout << ans << endl;
}