結果

問題 No.1862 Copy and Paste
ユーザー pockynypockyny
提出日時 2022-03-04 22:38:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 860 bytes
コンパイル時間 531 ms
コンパイル使用メモリ 68,844 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-11 10:47:11
合計ジャッジ時間 1,791 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,352 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 1 ms
4,352 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 1 ms
4,348 KB
testcase_30 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
typedef long long ll;
int main(){
    ll i,j,a,b,n; cin >> a >> b >> n;
    if(n==1){
        cout << 0 << endl;
        return 0;
    }
    ll ans = 1000000000000000000;
    for(i=1;i<=40;i++){
        ll le = 1,ri = n;
        while(ri - le>1){
            ll mid = (le + ri)/2,ret = 1;
            for(j=0;j<i;j++){
                ret *= mid;
                if(ret>=n) break;
            }
            if(ret>=n) ri = mid;
            else le = mid;
        }
        //if(i==4) cout << le << endl;
        ll ret = 1;
        for(j=0;j<i;j++) ret *= le;
        for(j=1;j<=i;j++){
            ret /= le;
            ret *= (le + 1);
            //if(i==4) cout << ret << endl;
            if(ret>=n){
                ans = min(ans,(le*i + j - i)*b + a*i);
            }
        }
    }
    cout << ans << endl;
}
0