結果

問題 No.2416 vs Slime
ユーザー bluemeganebluemegane
提出日時 2023-08-19 09:31:50
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 518 bytes
コンパイル時間 1,062 ms
コンパイル使用メモリ 65,304 KB
実行使用メモリ 24,848 KB
最終ジャッジ日時 2023-08-19 09:31:56
合計ジャッジ時間 4,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,608 KB
testcase_01 AC 58 ms
20,748 KB
testcase_02 AC 58 ms
18,704 KB
testcase_03 AC 58 ms
22,800 KB
testcase_04 AC 58 ms
22,628 KB
testcase_05 AC 58 ms
20,816 KB
testcase_06 AC 58 ms
20,672 KB
testcase_07 AC 58 ms
20,648 KB
testcase_08 AC 57 ms
20,700 KB
testcase_09 AC 58 ms
18,652 KB
testcase_10 AC 58 ms
22,620 KB
testcase_11 AC 58 ms
20,776 KB
testcase_12 AC 57 ms
22,924 KB
testcase_13 AC 57 ms
20,748 KB
testcase_14 AC 58 ms
20,664 KB
testcase_15 WA -
testcase_16 AC 58 ms
22,804 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 57 ms
22,580 KB
testcase_21 AC 58 ms
20,752 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 57 ms
20,760 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 57 ms
20,704 KB
testcase_28 AC 57 ms
20,596 KB
testcase_29 AC 57 ms
18,680 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 57 ms
20,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = long.Parse(line[0]);
        var a = long.Parse(line[1]);
        getAns(h, a);
    }
    static void getAns(long h, long a)
    {
        if (h / a == 0) { Console.WriteLine(1); return; }
        var ans = 1L;
        var p = 1L;
        while (h > 1)
        {
            h /= a;
            p *= 2;
            ans += p;
        }
        Console.WriteLine(ans);
    }
}
0