結果

問題 No.3 ビットすごろく
ユーザー moguoosan
提出日時 2016-08-24 16:09:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-11-08 02:03:41
合計ジャッジ時間 2,446 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def fnc(s):
    t = list(map(str,range(1,s+1)))
    pos = 0
    count = 1
    li = []
    while t[pos] != t[-1]:
        b = bin(int(t[pos]))
        tmp = str(b).count("1")
        if pos + tmp > len(t)-1:
            pos -= tmp
        else :
            pos += tmp
        if t[pos] in li:
            return -1
        count += 1
        li.append(t[pos])
    return count
print(fnc(int(input())))
0