結果
問題 | No.1453 手助け |
ユーザー |
![]() |
提出日時 | 2021-04-01 11:44:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 2,086 ms |
コンパイル使用メモリ | 194,024 KB |
最終ジャッジ日時 | 2025-01-20 04:55:32 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int a, b, c, d, e;cin >> a >> b >> c >> d >> e;int num = a * (b - c);if (num == 0) {cout << 0 << '\n';return 0;}vector<int> x(num + 1);x.at(1) = d;int ans = d;for (int i = 2; i <= num; i++) {if (i % 10 != 0) x.at(i) = x.at(i - 1);else {if (e <= x.at(i - 1)) x.at(i) = x.at(i - 1) - e;else x.at(i) = x.at(i - 1);}ans += x.at(i);}cout << ans << '\n';}