結果
| 問題 | No.5 数字のブロック |
| コンテスト | |
| ユーザー |
ruase_
|
| 提出日時 | 2025-08-14 21:38:50 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| + 86µs | |
| コード長 | 361 bytes |
| 記録 | |
| コンパイル時間 | 951 ms |
| コンパイル使用メモリ | 163,396 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-14 00:48:51 |
| 合計ジャッジ時間 | 2,556 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 34 |
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int l, n;
cin >> l >> n;
int a[n];
for(int i = 0 ; i < n; i++) cin >> a[i];
sort(a, a+n);
int sum = 0;
int i = 0;
int cnt = 0;
do{
sum = sum + a[i];
if (sum > l) break;
i++;
cnt++;
if (i==n) break;
}while (sum <= l);
cout << cnt << endl;
}
ruase_