結果

問題 No.555 世界史のレポート
ユーザー llllll
提出日時 2017-08-11 23:05:35
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 1,583 ms
コンパイル使用メモリ 166,212 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-12 21:44:28
合計ジャッジ時間 4,614 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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