結果

問題 No.3 ビットすごろく
ユーザー Shin09shinShin09shin
提出日時 2019-01-18 07:10:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,968 KB
実行使用メモリ 8,968 KB
最終ジャッジ日時 2023-09-18 06:58:21
合計ジャッジ時間 41,493 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

N = int(input())
a = 1
b = [1]
c = []
g = []
if N == 1:
    print(1)
else:    
    while a:
        c = b
        c = list(set(c))
        f = list(set(b)-set(g))
        print(b)
        print(c)
        print(f)
        print(g)
        for i in range(0,len(f)):
             d = bin(f[i]).count("1")
             p = f[i] + d 
             q = f[i] - d
             if p <= N:
                b.append(p)
             if q > 0:
                b.append(q)
        a += 1
        g = c
        b = list(set(b))
        if N in b:
            print(a)
            break
        if b == c:
            print(-1)
            break
0