結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-01-07 23:40:53 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 5,000 ms |
| + 106µs | |
| コード長 | 479 bytes |
| 記録 | |
| コンパイル時間 | 489 ms |
| コンパイル使用メモリ | 103,496 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-09-25 14:01:37 |
| 合計ジャッジ時間 | 2,199 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <set>
#include <cmath>
using namespace std;
int main(){
int L;
cin >> L;
int N;
cin >> N;
vector<int> W(N);
for(int i=0; i<N; i++){
cin >> W[i];
}
sort(W.begin(), W.end());
int ans = 0;
for(int i=0; i<N; i++){
if(L-W[i]>=0){
ans++;
L-=W[i];
}else{
break;
}
}
cout << ans << endl;
return 0;
}
koyumeishi