結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
piniky
|
| 提出日時 | 2015-09-02 14:53:09 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 526 ms |
| コンパイル使用メモリ | 58,808 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 17:50:41 |
| 合計ジャッジ時間 | 1,340 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 14 |
ソースコード
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
int main(){
int L, N, nowL = 0, W[10001];
cin >> L >> N;
for (int i = 0; i < N; i++) cin >> W[i];
sort(W, W+N);
for (int i = 0; i < N; i++){
if (nowL < L){
nowL += W[i];
}
else{
cout << i - 1 << endl;
return 0;
}
}
cout << N - 1<< endl;
return 0;
}
piniky