結果

問題 No.1453 手助け
ユーザー Mister
提出日時 2021-03-31 21:30:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 698 ms
コンパイル使用メモリ 67,660 KB
最終ジャッジ日時 2025-01-20 02:55:49
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#include <iostream>

using namespace std;

void solve() {
    int a, b, c, d, e;
    cin >> a >> b >> c >> d >> e;

    int n = a * (b - c);
    if (n == 0) {
        cout << "0\n";
        return;
    }

    int ans = d, x = d;
    for (int i = 2; i <= n; ++i) {
        if (i % 10 == 0 && e <= x) x -= e;
        ans += x;
    }
    cout << ans << "\n";
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    solve();

    return 0;
}
0