結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
agis
|
| 提出日時 | 2017-03-27 20:43:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 393 bytes |
| コンパイル時間 | 650 ms |
| コンパイル使用メモリ | 59,784 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-06 12:19:53 |
| 合計ジャッジ時間 | 1,234 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 34 |
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int L,N;
int W[10000];
cin >> L;
cin >> N;
for (int i = 0;i <= N-1;i++) {
cin >> W[i];
}
cout << endl;
sort(W, W + N);
int l=0;
int j = 0;
while (j != N) {
l = l + W[j];
if (l > L) {
cout << j << endl;
break;
}else if (l == L) {
cout << j + 1 << endl;
break;
}
j++;
}
return 0;
}
agis