Submission #00117
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <bits/stdc++.h> using namespace std; #define endl "\n" int main() { int n, j = 1; int ans[51] = {}; do { cin >> n; int a[n]; for ( int i = 0; i < n; i++) { cin >> a[i]; if (ans[j] <= 300) { ans[j] += a[i]; if (ans[j] > 300) { ans[j] -= a[i]; } } } j = j + 1; } while (n != 0); for ( int i = 1; i < j - 1; i++) { cout<< ans[i] << endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0003 - おやつは300円以内 |
ユーザー名 | ei2439 |
投稿日時 | 2025-03-28 12:40:46 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 550 Byte |
最大実行時間 | 24 ms |
最大メモリ使用量 | 448 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
A1 | AC | 20 ms | 348 KB |
1
|
A2 | AC | 21 ms | 448 KB |
1
|
A3 | AC | 18 ms | 420 KB |
1
|
A4 | AC | 24 ms | 392 KB |
1
|