結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
21,160 KB
testcase_01 AC 55 ms
21,272 KB
testcase_02 AC 55 ms
19,284 KB
testcase_03 AC 54 ms
20,800 KB
testcase_04 AC 54 ms
20,772 KB
testcase_05 WA -
testcase_06 AC 56 ms
23,116 KB
testcase_07 AC 56 ms
21,280 KB
testcase_08 AC 55 ms
21,112 KB
testcase_09 AC 55 ms
21,312 KB
testcase_10 AC 55 ms
21,268 KB
testcase_11 AC 55 ms
19,036 KB
testcase_12 AC 55 ms
23,096 KB
testcase_13 AC 55 ms
21,172 KB
testcase_14 AC 54 ms
19,156 KB
testcase_15 AC 55 ms
21,064 KB
testcase_16 AC 55 ms
21,260 KB
testcase_17 AC 55 ms
23,204 KB
testcase_18 AC 55 ms
21,124 KB
testcase_19 AC 55 ms
21,296 KB
testcase_20 AC 55 ms
21,240 KB
testcase_21 AC 55 ms
21,256 KB
testcase_22 AC 56 ms
23,264 KB
testcase_23 AC 55 ms
21,272 KB
testcase_24 AC 55 ms
19,108 KB
testcase_25 AC 55 ms
21,148 KB
testcase_26 AC 55 ms
21,072 KB
testcase_27 AC 55 ms
21,264 KB
testcase_28 AC 55 ms
21,108 KB
testcase_29 AC 55 ms
21,168 KB
testcase_30 AC 55 ms
23,176 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 55 ms
23,256 KB
testcase_38 WA -
testcase_39 AC 56 ms
21,188 KB
testcase_40 AC 55 ms
21,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        if (n <= 2) 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