結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
sigma425
|
| 提出日時 | 2015-04-25 09:03:40 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 521 bytes |
| コンパイル時間 | 1,119 ms |
| コンパイル使用メモリ | 164,080 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-17 22:40:30 |
| 合計ジャッジ時間 | 1,936 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
vector<int> d;
int main(){
int a,b;
cin>>a>>b;
rep(i,b){
int c;
cin>>c;
d.pb(c);
}
sort(all(d));
int e=0;
rep(i,b){
a-=d[i];
if(a<0) break;
e++;
}
cout<<e<<endl;
}
sigma425