結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
HeyHey0111
|
| 提出日時 | 2016-02-17 21:20:18 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 401 bytes |
| 記録 | |
| コンパイル時間 | 689 ms |
| コンパイル使用メモリ | 83,056 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-12 20:37:12 |
| 合計ジャッジ時間 | 2,147 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> l(m);
for(int i=0;i< m ;i++){
cin >> l[i];
}
sort(l.begin(),l.end());
int sum=0,x=0;
while(1){
if(sum>n){
cout<<x-1<<endl;
return 0;
}
if(x==m){
cout<<x<<endl;
return 0;
}
sum+=l[x];
x++;
}
cout<<x-1<<endl;
return 0;
}
HeyHey0111