結果

問題 No.1664 Unstable f(n)
ユーザー bluemeganebluemegane
提出日時 2021-09-04 07:32:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 1,063 ms
コンパイル使用メモリ 65,300 KB
実行使用メモリ 23,324 KB
最終ジャッジ日時 2023-08-22 13:40:06
合計ジャッジ時間 4,743 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,268 KB
testcase_01 AC 55 ms
21,220 KB
testcase_02 AC 54 ms
21,112 KB
testcase_03 AC 54 ms
20,832 KB
testcase_04 AC 54 ms
20,660 KB
testcase_05 AC 53 ms
20,596 KB
testcase_06 AC 55 ms
23,324 KB
testcase_07 AC 55 ms
21,256 KB
testcase_08 AC 55 ms
21,172 KB
testcase_09 AC 55 ms
21,208 KB
testcase_10 AC 55 ms
23,196 KB
testcase_11 AC 56 ms
21,148 KB
testcase_12 AC 55 ms
23,320 KB
testcase_13 AC 55 ms
21,264 KB
testcase_14 AC 55 ms
21,044 KB
testcase_15 AC 54 ms
21,168 KB
testcase_16 AC 55 ms
21,264 KB
testcase_17 AC 55 ms
23,036 KB
testcase_18 AC 55 ms
19,244 KB
testcase_19 AC 55 ms
21,212 KB
testcase_20 AC 55 ms
23,104 KB
testcase_21 AC 56 ms
23,292 KB
testcase_22 AC 55 ms
23,096 KB
testcase_23 AC 54 ms
19,264 KB
testcase_24 AC 54 ms
21,252 KB
testcase_25 AC 55 ms
21,180 KB
testcase_26 AC 54 ms
21,080 KB
testcase_27 AC 55 ms
20,988 KB
testcase_28 AC 55 ms
21,108 KB
testcase_29 AC 55 ms
21,060 KB
testcase_30 AC 55 ms
21,180 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 56 ms
21,160 KB
testcase_38 WA -
testcase_39 AC 54 ms
21,112 KB
testcase_40 AC 56 ms
21,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        if (n <= 3) Console.WriteLine(n);
        else getAns(n);
    }
    static void getAns(long n)
    {
        var ans = n + 1;
        var imax = (int)(Log10(n) / Log10(2));
        for (int j = 2; j <= imax; j++)
        {
            var i = (int)Pow(n, 1d / j);
            var x = 1L;
            for (int a = 0; a < j; a++) x *= i;
            var k = n - x;
            ans = Min(ans, i + j + k);
        }
        Console.WriteLine(ans);
    }
}
0