結果

問題 No.642 Two Operations No.1
ユーザー wagashi1349
提出日時 2018-02-22 16:32:36
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 638 bytes
コンパイル時間 4,324 ms
コンパイル使用メモリ 107,056 KB
実行使用メモリ 25,800 KB
最終ジャッジ日時 2024-10-01 20:37:19
合計ジャッジ時間 1,698 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
        {
            Int64 N = Int64.Parse(Console.ReadLine());
            Int64 X = 1;
            Int64 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