結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
_matumo_
|
| 提出日時 | 2018-05-30 10:15:10 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,171 bytes |
| コンパイル時間 | 819 ms |
| コンパイル使用メモリ | 112,676 KB |
| 実行使用メモリ | 27,720 KB |
| 最終ジャッジ日時 | 2024-06-30 08:11:14 |
| 合計ジャッジ時間 | 2,548 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
}
}
}
_matumo_