結果

問題 No.3 ビットすごろく
ユーザー keymoon
提出日時 2024-12-17 03:56:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,248 KB
最終ジャッジ日時 2024-12-17 03:56:26
合計ジャッジ時間 8,431 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 15 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

inp1 = input()
inp1 = int(inp1)

def make_dis(eng):
    mass = list(bin(eng))
    count = 0
    for s in mass:
        if s == "1":
            count = count + 1
    return count

now = 1
count = 1
bad = 0

while now <= inp1:
    dis = make_dis(now)
    now = now + dis
    if now == inp1:
        count = count + 1
        break
    elif now > inp1:
        now = now - dis - dis
        bad = bad + 1
    if bad > 10:
        count = -1
        break
    count = count + 1

print(count)
0