結果

問題 No.1664 Unstable f(n)
ユーザー CleyLCleyL
提出日時 2022-08-27 22:54:32
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-04-23 01:33:09
合計ジャッジ時間 4,380 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
13,756 KB
testcase_01 AC 5 ms
6,820 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 4 ms
6,944 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 4 ms
6,944 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
int main(){
    long long a;cin>>a;
    long long ans =(long long)sqrt(a)+2+a-(long long)sqrt(a)*(long long)sqrt(a);
    for(int i = 2; 1000001 > i; i++){
        long long nw = 1;
        for(int j = 0; a >= nw; j++){
            if(ans == -1)ans = i+j+a-nw;
            else ans = min(ans,i+j+a-nw);
            nw *= i;
        }
    }
    cout << ans << endl;
}
0