結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー ccc
提出日時 2022-10-15 23:22:04
言語 C#
(.NET 8.0.404)
結果
WA  
実行時間 -
コード長 865 bytes
コンパイル時間 7,280 ms
コンパイル使用メモリ 165,272 KB
実行使用メモリ 194,200 KB
最終ジャッジ日時 2024-06-26 22:09:39
合計ジャッジ時間 9,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;
using System.Runtime.Intrinsics.X86;
using System.Diagnostics;

namespace yukicoder 
{
    class Program
    {
        static void Main()
        {
            var inp = int.Parse(Console.ReadLine());
            var cnt = 0;

            while (inp > 1) 
            {
                inp = inp /= 2;
                //Console.WriteLine(inp);
                cnt++;

            }
            
            if (IsEven(cnt))
            {
                //cnt = cnt + 2;
                Console.WriteLine(cnt);
            }
            else
            {

                cnt = cnt + 1; 
                Console.WriteLine(cnt);
                //Console.WriteLine("-");
            }
        }
        public static bool IsEven(int num)
        {
            return num % 2 == 0;
        }
    }
}
0