結果

問題 No.1869 Doubling?
ユーザー bluemeganebluemegane
提出日時 2022-03-12 10:04:30
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 63,160 KB
実行使用メモリ 24,960 KB
最終ジャッジ日時 2023-10-14 21:55:04
合計ジャッジ時間 6,648 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,788 KB
testcase_01 AC 55 ms
20,868 KB
testcase_02 AC 55 ms
20,772 KB
testcase_03 AC 55 ms
20,784 KB
testcase_04 AC 55 ms
20,684 KB
testcase_05 AC 57 ms
22,812 KB
testcase_06 AC 54 ms
18,640 KB
testcase_07 AC 55 ms
22,756 KB
testcase_08 AC 55 ms
20,724 KB
testcase_09 WA -
testcase_10 AC 56 ms
22,708 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 55 ms
20,592 KB
testcase_16 AC 56 ms
20,680 KB
testcase_17 AC 56 ms
20,656 KB
testcase_18 AC 56 ms
22,740 KB
testcase_19 AC 56 ms
20,872 KB
testcase_20 AC 57 ms
22,844 KB
testcase_21 AC 55 ms
20,772 KB
testcase_22 AC 56 ms
20,616 KB
testcase_23 AC 56 ms
20,692 KB
testcase_24 AC 57 ms
22,740 KB
testcase_25 AC 57 ms
20,704 KB
testcase_26 AC 56 ms
20,696 KB
testcase_27 AC 56 ms
20,672 KB
testcase_28 AC 56 ms
20,792 KB
testcase_29 AC 56 ms
20,808 KB
testcase_30 AC 57 ms
20,732 KB
testcase_31 AC 57 ms
22,728 KB
testcase_32 AC 56 ms
20,656 KB
testcase_33 AC 56 ms
18,744 KB
testcase_34 AC 56 ms
20,768 KB
testcase_35 AC 56 ms
20,600 KB
testcase_36 AC 56 ms
20,772 KB
testcase_37 AC 56 ms
20,876 KB
testcase_38 AC 56 ms
22,712 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 56 ms
20,664 KB
testcase_43 AC 56 ms
20,652 KB
testcase_44 WA -
testcase_45 AC 57 ms
20,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        getAns(n, m);
    }
    static void getAns(int n, int m)
    {
        var count = 0;
        long ans = m;
        while (m > 1)
        {
            m = m % 2 == 0 ? m / 2 : (m + 1) / 2;
            ans += m;
            count++;
        }
        ans += n - count - 1;
        Console.WriteLine(ans);
    }
}
0