結果

問題 No.1664 Unstable f(n)
ユーザー HeartConjuratorHeartConjurator
提出日時 2021-09-03 23:23:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 613 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 67,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 07:19:10
合計ジャッジ時間 3,579 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cmath>
using namespace std;
long long kpow(long long x, long long n)
{
    if (n == 0)
        return 1;
    long long t = 1;
    while (n)
    {
        if (n & 1)
            t *= x;
        n >>= 1;
        x *= x;
    }
    return t;
}
int main()
{
    long long n;
    scanf("%lld", &n);
    long long ans = n;
    long long i = 1, j = 0, k = n-1;
    long long lst = n + 1;
    for(int h=1;h<=500000;h++)
    {
        j++;
        i = pow(n*1.0, 1.0 / j);
        k = n - kpow(i, j);
        ans = min(ans, i + j + k);
        
    }
    printf("%lld\n", ans);
    return 0;
}
0