結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
jdksk31
|
| 提出日時 | 2023-04-28 19:53:12 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 380 bytes |
| 記録 | |
| コンパイル時間 | 1,260 ms |
| コンパイル使用メモリ | 214,836 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-30 11:01:41 |
| 合計ジャッジ時間 | 2,718 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug if(0)
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int l, n; cin>>l>>n;
vector<int> w(n);
for(int &x : w) cin>>x;
sort(w.begin(), w.end());
int sum = 0, ans = 0;
for(int i=0; i<n; i++) {
if((sum+w[i]) > l) break;
else {
sum += w[i];
ans++;
}
}
cout<<ans<<"\n";
}
jdksk31