結果
| 問題 |
No.5 数字のブロック
|
| ユーザー |
|
| 提出日時 | 2023-01-25 17:26:26 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 5,000 ms |
| コード長 | 348 bytes |
| コンパイル時間 | 632 ms |
| コンパイル使用メモリ | 77,852 KB |
| 最終ジャッジ日時 | 2025-02-10 06:46:20 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
int main(){
int l;
int n;
std::cin>>l>>n;
std::vector<int> w(n);
for(int& element : w){
std::cin>>element;
}
std::sort(w.begin(),w.end());
int count=0;
while(n>count&&l>=w[count]){
l-=w[count];
count++;
}
std::cout<<count;
}