結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
Dadarithm
|
| 提出日時 | 2015-09-13 22:40:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 819 ms |
| コンパイル使用メモリ | 64,984 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 06:23:39 |
| 合計ジャッジ時間 | 1,698 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 WA * 10 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
int L, N; vector<int> W;
cin >> L >> N;
for (int i = 0; i < N; ++i)
{
int key;
cin >> key;
W.push_back(key);
}
sort(W.begin(), W.end());
int ans = 0, counter = 0;
while (ans <= L)
{
ans += W[counter];
++counter;
}
--counter;
cout << counter << endl;
return 0;
}
Dadarithm