結果

問題 No.3 ビットすごろく
ユーザー tkr182tkr182
提出日時 2018-10-01 11:38:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 476 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 14,016 KB
最終ジャッジ日時 2024-04-20 14:03:58
合計ジャッジ時間 28,233 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 26 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 420 ms
11,136 KB
testcase_04 AC 70 ms
10,880 KB
testcase_05 AC 1,838 ms
11,428 KB
testcase_06 AC 529 ms
11,136 KB
testcase_07 AC 195 ms
10,880 KB
testcase_08 AC 1,110 ms
11,392 KB
testcase_09 AC 2,845 ms
12,164 KB
testcase_10 AC 3,731 ms
12,288 KB
testcase_11 AC 2,402 ms
11,496 KB
testcase_12 AC 1,667 ms
11,404 KB
testcase_13 AC 311 ms
11,136 KB
testcase_14 AC 3,630 ms
12,284 KB
testcase_15 TLE -
testcase_16 AC 4,973 ms
12,472 KB
testcase_17 TLE -
testcase_18 AC 238 ms
11,136 KB
testcase_19 TLE -
testcase_20 AC 48 ms
10,880 KB
testcase_21 AC 26 ms
10,752 KB
testcase_22 AC 3,717 ms
12,416 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 27 ms
10,752 KB
testcase_27 AC 369 ms
11,136 KB
testcase_28 AC 4,860 ms
12,292 KB
testcase_29 AC 2,478 ms
12,288 KB
testcase_30 AC 26 ms
10,752 KB
testcase_31 AC 28 ms
10,752 KB
testcase_32 AC 2,219 ms
11,692 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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