結果
問題 | No.3 ビットすごろく |
ユーザー | tkr182 |
提出日時 | 2018-10-01 12:02:01 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 476 bytes |
コンパイル時間 | 402 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 19,360 KB |
最終ジャッジ日時 | 2024-04-20 14:06:46 |
合計ジャッジ時間 | 28,084 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
10,752 KB |
testcase_01 | AC | 28 ms
10,752 KB |
testcase_02 | AC | 30 ms
10,752 KB |
testcase_03 | AC | 466 ms
11,264 KB |
testcase_04 | AC | 74 ms
10,880 KB |
testcase_05 | AC | 1,956 ms
11,428 KB |
testcase_06 | AC | 549 ms
11,136 KB |
testcase_07 | AC | 213 ms
11,008 KB |
testcase_08 | AC | 1,212 ms
11,488 KB |
testcase_09 | AC | 3,161 ms
12,156 KB |
testcase_10 | AC | 4,108 ms
12,408 KB |
testcase_11 | AC | 2,646 ms
11,680 KB |
testcase_12 | AC | 1,885 ms
11,656 KB |
testcase_13 | AC | 329 ms
11,264 KB |
testcase_14 | AC | 3,972 ms
12,416 KB |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
ソースコード
N=int(input()) a=1 c=[1] d=[] if N==1: print(1) else: while a: 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