結果

問題 No.555 世界史のレポート
ユーザー llllll
提出日時 2017-08-11 23:05:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 162,960 KB
実行使用メモリ 4,904 KB
最終ジャッジ日時 2023-08-02 23:33:03
合計ジャッジ時間 4,682 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 189 ms
4,720 KB
testcase_11 AC 227 ms
4,640 KB
testcase_12 AC 186 ms
4,568 KB
testcase_13 AC 148 ms
4,512 KB
testcase_14 AC 215 ms
4,552 KB
testcase_15 AC 222 ms
4,556 KB
testcase_16 AC 169 ms
4,656 KB
testcase_17 AC 201 ms
4,552 KB
testcase_18 AC 229 ms
4,868 KB
testcase_19 AC 342 ms
4,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const ll inf = 1e10;
ll ans = inf;
ll n, c, v;

void dfs(ll num, ll cNum, ll cost) {
    if (num >= n) {
        ans = min(ans, cost);
        return;
    }
    dfs(num + cNum, cNum, cost+v);
    dfs(num + num, num, cost+c+v);
}

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

    cin >> n >> c >> v;

    dfs(1, 1, c);
    cout << ans << endl;

    return 0;
}
0