結果
| 問題 |
No.5 数字のブロック
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-04-04 22:08:59 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 441 bytes |
| コンパイル時間 | 549 ms |
| コンパイル使用メモリ | 66,200 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 08:27:32 |
| 合計ジャッジ時間 | 1,522 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int L, N, ans=0;
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(), std::less<int>());
for(;ans<N; ++ans){
L -= W[ans];
if(L<0) break;
}
std::cout << ans << "\n";
return 0;
}