結果

問題 No.642 Two Operations No.1
ユーザー wagashi1349wagashi1349
提出日時 2018-02-22 16:30:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 630 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 108,348 KB
実行使用メモリ 25,816 KB
最終ジャッジ日時 2024-04-09 20:19:23
合計ジャッジ時間 1,646 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
25,676 KB
testcase_01 AC 18 ms
21,688 KB
testcase_02 AC 17 ms
23,980 KB
testcase_03 AC 17 ms
23,644 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 18 ms
25,660 KB
testcase_14 AC 18 ms
23,752 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int X = 1;
            int time = 0;
            if (N == 0)
            {
                Console.WriteLine(1);
                return;
            }
            if (N == 1)
            {
                Console.WriteLine(0);
                return;
            }

            while(N > X)
            {
                X = X << 1;
                time++;
            }

            time += X - N;
            Console.WriteLine(time);
        }
    }
}
0