結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
fuu32
|
| 提出日時 | 2017-10-29 14:16:08 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 577 bytes |
| 記録 | |
| コンパイル時間 | 1,089 ms |
| コンパイル使用メモリ | 186,312 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-12 23:44:30 |
| 合計ジャッジ時間 | 2,258 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FIR first
#define UB upper_bound
#define LB lower_bound
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;
signed main(){
int l,n;
cin>>l>>n;
vector<int> w(n);
REP(i,n)cin>>w[i];
sort(ALL(w));
int ans=0;
REP(i,n){
if(l-w[i]>=0){
ans++;
l-=w[i];
}else{
break;
}
}
cout<<ans<<endl;
return 0;
}
fuu32