結果

問題 No.1664 Unstable f(n)
ユーザー bluemeganebluemegane
提出日時 2021-09-04 07:06:18
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 65,284 KB
実行使用メモリ 25,244 KB
最終ジャッジ日時 2023-08-22 13:04:37
合計ジャッジ時間 4,798 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,304 KB
testcase_01 AC 55 ms
21,236 KB
testcase_02 AC 55 ms
19,308 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 54 ms
21,220 KB
testcase_07 AC 54 ms
21,228 KB
testcase_08 AC 56 ms
23,316 KB
testcase_09 AC 54 ms
21,220 KB
testcase_10 AC 53 ms
23,120 KB
testcase_11 AC 53 ms
21,172 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 54 ms
21,204 KB
testcase_15 AC 55 ms
21,244 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 54 ms
21,264 KB
testcase_22 AC 54 ms
23,300 KB
testcase_23 AC 55 ms
19,240 KB
testcase_24 AC 55 ms
23,320 KB
testcase_25 AC 54 ms
21,356 KB
testcase_26 AC 53 ms
21,184 KB
testcase_27 AC 53 ms
21,184 KB
testcase_28 AC 56 ms
23,288 KB
testcase_29 AC 55 ms
21,088 KB
testcase_30 AC 54 ms
21,184 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 54 ms
21,148 KB
testcase_38 WA -
testcase_39 AC 54 ms
21,260 KB
testcase_40 AC 56 ms
23,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using static System.Math;
using System;

public class Hello
{
    static void Main()
    {
        var n = long.Parse(Console.ReadLine().Trim());
        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 k = n - (long)Pow(i, j);
            ans = Min(ans, i + j + k);
        }
        Console.WriteLine(ans);
    }
}
0