結果

問題 No.47 ポケットを叩くとビスケットが2倍
ユーザー water_is_Iwater_is_I
提出日時 2017-03-16 23:08:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 1,017 bytes
コンパイル時間 1,685 ms
コンパイル使用メモリ 101,712 KB
実行使用メモリ 22,768 KB
最終ジャッジ日時 2023-09-17 05:24:10
合計ジャッジ時間 3,764 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
20,796 KB
testcase_01 AC 48 ms
22,744 KB
testcase_02 AC 47 ms
20,696 KB
testcase_03 AC 48 ms
20,672 KB
testcase_04 AC 46 ms
20,716 KB
testcase_05 AC 48 ms
20,728 KB
testcase_06 AC 50 ms
18,732 KB
testcase_07 AC 47 ms
20,732 KB
testcase_08 AC 48 ms
20,660 KB
testcase_09 AC 47 ms
22,768 KB
testcase_10 AC 46 ms
20,596 KB
testcase_11 AC 47 ms
22,744 KB
testcase_12 AC 47 ms
18,596 KB
testcase_13 AC 46 ms
18,736 KB
testcase_14 AC 51 ms
18,620 KB
testcase_15 AC 50 ms
22,696 KB
testcase_16 AC 50 ms
20,656 KB
testcase_17 AC 47 ms
18,616 KB
testcase_18 AC 49 ms
20,744 KB
testcase_19 AC 47 ms
22,632 KB
testcase_20 AC 48 ms
20,648 KB
testcase_21 AC 48 ms
22,724 KB
testcase_22 AC 48 ms
20,688 KB
testcase_23 AC 46 ms
20,728 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 yukicoder_001 {
    class Program {
        static void Main(string[] args) {
            string NS = Console.ReadLine();
            int N = Int32.Parse(NS);
            Console.WriteLine(Count(N));//N渡して
            
        }

        static int pocket(int bis) {
            return bis * 2;
        }

        static int Count(int N) {
            int bis = 1;
            int i = 0;
            while (N > pocket(bis)) {
                bis = pocket(bis);
                i++;
            }
            if (N - bis == 0) return i;
            int N2 = N - bis;
            /*
            if (N / 2 < N2)
                i++;
            if (N2 != 0) {
                return i++;
            }
            int bis2 = N2/2;
            while (N + N2 > bis + pocket(bis2)) {
                bis2 = pocket(bis2);
                i++;
            }
            */
            if (N2 % 2 == 0 || N2 % 2 == 1) {
                i++;
            }
            return i;
        }
    }
}
0