結果

問題 No.3 ビットすごろく
ユーザー lunaticcrylunaticcry
提出日時 2016-01-22 01:38:58
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 7,064 KB
実行使用メモリ 6,532 KB
最終ジャッジ日時 2023-10-21 13:44:50
合計ジャッジ時間 1,661 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
6,460 KB
testcase_01 AC 8 ms
6,460 KB
testcase_02 AC 10 ms
6,460 KB
testcase_03 AC 10 ms
6,476 KB
testcase_04 AC 10 ms
6,464 KB
testcase_05 AC 10 ms
6,496 KB
testcase_06 AC 11 ms
6,480 KB
testcase_07 AC 10 ms
6,472 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 11 ms
6,496 KB
testcase_13 AC 9 ms
6,476 KB
testcase_14 AC 10 ms
6,516 KB
testcase_15 AC 11 ms
6,532 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 10 ms
6,472 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 9 ms
6,460 KB
testcase_22 AC 10 ms
6,520 KB
testcase_23 AC 15 ms
6,532 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 9 ms
6,460 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 11 ms
6,460 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-
__author__ = 'yuuki'
#No.3 ビットすごろく

N = input()
bN = bin(N)
M = 1
c = 0
L = [0] * N

while(1):
    c += 1

    if M == N:
        print c
        break
    elif L[M-1] == 1:
        print "-1"
        break
    elif M + bin(M).count("1") > N:
        L[M-1] = 1
        M -= bin(M).count("1")
    else:
        M += bin(M).count("1")
0