結果

問題 No.3 ビットすごろく
ユーザー maburoemaburoe
提出日時 2019-05-22 13:00:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 490 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 11,772 KB
実行使用メモリ 10,168 KB
最終ジャッジ日時 2023-10-17 11:10:54
合計ジャッジ時間 2,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,044 KB
testcase_01 AC 29 ms
10,044 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 31 ms
10,044 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 30 ms
10,076 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 30 ms
10,080 KB
testcase_19 AC 31 ms
10,168 KB
testcase_20 WA -
testcase_21 AC 29 ms
10,044 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 29 ms
10,044 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 31 ms
10,100 KB
testcase_30 WA -
testcase_31 AC 29 ms
10,044 KB
testcase_32 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

goal = int(input())

# goal_1bit_num = bin(goal)
# print(goal_1bit_num.count('1'))

count = 1
position = 1
used = {1}

while position in range(1, goal):
    position_1bit_num = bin(position)
    if position + position_1bit_num.count('1') <= goal:
        position = position + position_1bit_num.count('1')
    else:
        position = position - position_1bit_num.count('1')

    if position in used:
        position = -1
    else:
        used.add(position)

    count += 1

print(count)
0