結果

問題 No.3 ビットすごろく
ユーザー _matumo__matumo_
提出日時 2018-05-30 10:15:10
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,171 bytes
コンパイル時間 1,968 ms
コンパイル使用メモリ 104,936 KB
実行使用メモリ 24,848 KB
最終ジャッジ日時 2023-09-12 20:35:22
合計ジャッジ時間 5,006 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
18,728 KB
testcase_01 AC 56 ms
22,936 KB
testcase_02 AC 51 ms
18,716 KB
testcase_03 AC 54 ms
20,912 KB
testcase_04 AC 53 ms
20,784 KB
testcase_05 AC 53 ms
20,872 KB
testcase_06 AC 54 ms
20,744 KB
testcase_07 AC 53 ms
20,792 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 53 ms
20,812 KB
testcase_13 AC 53 ms
20,788 KB
testcase_14 AC 54 ms
22,816 KB
testcase_15 AC 53 ms
22,896 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 53 ms
20,680 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 54 ms
22,828 KB
testcase_22 AC 54 ms
20,808 KB
testcase_23 AC 54 ms
20,936 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 54 ms
22,864 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 54 ms
20,772 KB
testcase_32 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        static bool[] ng;
        static int rootN = -1;
        //------------------------------------------------------------------------------//
        static bool xxxxx(int ni, int nx)
        {
            if (ni <  1 )   return false;
            if (ni >  nx)   return false;
            if (ni == nx) { rootN = 1; return true; }
            if (ng[ni])     return false;
            ng[ni] = true;
            int n = 0;
            for (int nn = ni; nn > 0; nn >>= 1)
            {
                n += (nn & 1);
            }
            if (xxxxx(ni + n, nx)) { rootN++; return true; }
            if (xxxxx(ni - n, nx)) { rootN++; return true; }
            return false;
        }
        //------------------------------------------------------------------------------//
        static void Main(string[] args)
        {
            int nx = int.Parse(Console.ReadLine());

            ng = new Boolean[nx];
            xxxxx(1, nx);
            Console.WriteLine(rootN);
            Console.ReadLine();
        }
    }
}

0