結果
| 問題 |
No.3 ビットすごろく
|
| コンテスト | |
| ユーザー |
ub_nyaoiix
|
| 提出日時 | 2016-12-18 12:52:41 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 547 bytes |
| コンパイル時間 | 1,356 ms |
| コンパイル使用メモリ | 107,940 KB |
| 実行使用メモリ | 26,068 KB |
| 最終ジャッジ日時 | 2024-12-14 08:14:01 |
| 合計ジャッジ時間 | 3,507 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Q0003
{
public static void Main()
{
int n = int.Parse(Console.ReadLine());
bool[] is_stop = new bool[n];
int count = 1;
int prev = -1;
for(int i=1; ;)
{
if (i == n)
{
break;
}
int add = 0;
for (int j=i; j>0; j/=2)
{
if(j%2 > 0)
{
add ++;
}
}
if(i+add > n)
{
i -= add;
if(is_stop[i - 1])
{
count = -1;
break;
}
}
else
{
i += add;
}
prev = i;
is_stop[i - 1] = true;
count++;
}
Console.WriteLine(count);
}
}
ub_nyaoiix