結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
tkzw_21
|
| 提出日時 | 2015-01-29 10:34:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 514 bytes |
| コンパイル時間 | 1,334 ms |
| コンパイル使用メモリ | 162,308 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 22:19:24 |
| 合計ジャッジ時間 | 1,899 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef pair<int,int> P;
typedef pair<int,pair<int,int>> PP;
typedef long long LL;
const double EPS = 1e-8;
const int INF = 1e9;
int dy[] = {0,1,0,-1};
int dx[] = {1,0,-1,0};
int main(void) {
int L;
int N;
cin >> L >> N;
vector<int> w(N);
for(int i=0;i<N;i++)cin >> w[i];
sort(w.begin(),w.end());
int sum = 0,cnt = 0;
for(int i=0;i<N;i++){
if(sum + w[i] > L)break;
sum += w[i];
cnt++;
}
cout << cnt << endl;
return 0;
}
tkzw_21