結果

問題 No.1664 Unstable f(n)
ユーザー FlappyWGFlappyWG
提出日時 2021-09-03 22:59:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 1,268 ms
コンパイル使用メモリ 67,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-09 06:20:18
合計ジャッジ時間 2,522 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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 + 1;
    long long i = n, j = 1, k = 0;
    long long lst=n+1;
    while (1)
    {
        j++;
        i=pow(n,1.0/j);
        k=n-kpow(i,j);
        ans=min(ans,i+j+k);
        if(i+j+k>ans)
        {
            printf("%lld\n",ans);
            break;
        }
        // if(ans==lst)
        // {
            
        //     break;
        // }
        // lst=ans;
    }
    return 0;
}
0