結果

問題 No.3 ビットすごろく
ユーザー konabe
提出日時 2017-12-09 18:13:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 373 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,632 KB
最終ジャッジ日時 2024-11-30 05:28:14
合計ジャッジ時間 110,042 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 7 TLE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

def step(num):
    return sum(list(map(int, list(format(num, 'b')))))

step.res_dict = {}

N = int(input())
m = 1
cnt = 0
while True:
    next = step(m)
    cnt += 1
    if N < m + next:
        m -= next
    elif N > m + next:
        m += next
    else:
        m += next
        cnt += 1
        print(cnt)
        break
    if cnt > N*N:
        print(-1)
        break
0