結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2016-03-21 23:02:57 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 983 ms |
| コンパイル使用メモリ | 64,456 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-01 12:29:42 |
| 合計ジャッジ時間 | 1,840 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 WA * 14 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int l,n;
std::cin >> l >> n;
std::vector<int> w(n);
for (int i = 0; i < n; i++) {
std::cin >> w[i];
}
std::sort(w.begin(),w.end());
int ans = 0;
int sum = 0;
for (int k = 0; sum<l ; k++, ans++) {
sum += w[k];
}
std::cout << ans-1 << std::endl;
return 0;
}