結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
Yut176
|
| 提出日時 | 2016-06-03 23:57:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 456 bytes |
| コンパイル時間 | 613 ms |
| コンパイル使用メモリ | 66,604 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-18 08:39:56 |
| 合計ジャッジ時間 | 1,704 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
#include<vector>
#include<string>
#include<sstream>
using namespace std;
int main(){
int l,n;
int ans=0;
cin >> l;
cin >> n;
vector<int> w;
for(int i=0;i<n;i++){
int tmp;
cin >> tmp;
w.push_back(tmp);
}
sort(w.begin(),w.end());
for(int i=0;i<w.size();i++){
l -= w[i];
if(l < 0) break;
ans++;
}
cout << ans << endl;
return 0;
}
Yut176