結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
ongakucas
|
| 提出日時 | 2019-12-09 11:11:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 417 bytes |
| コンパイル時間 | 1,533 ms |
| コンパイル使用メモリ | 171,452 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-12 04:51:54 |
| 合計ジャッジ時間 | 2,576 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
int l,n;
cin >> l >> n;
vector<int> w(n);
rep(i,n){
cin >> w[i];
}
sort(w.begin(),w.end());
int sum = 0;
int count = 0;
rep(i,n){
sum += w[i];
if(sum <= l)count++;
else break;
}
cout << count << endl;
}
ongakucas