結果
問題 |
No.3 ビットすごろく
|
ユーザー |
![]() |
提出日時 | 2018-08-19 17:50:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 507 bytes |
コンパイル時間 | 245 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-17 18:26:07 |
合計ジャッジ時間 | 2,226 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 33 |
ソースコード
n=7 lst = [0]*(n+1) def f(num,cnt): print(num,len(cnt)) if num==n: print(len(lst)) return True step = str(bin(num))[2:].count("1") fowd_n = num+step back_n = num-step if fowd_n<=n and fowd_n not in cnt: cnt.append(fowd_n) if f(fowd_n,cnt): return True if back_n>0 and back_n not in cnt: cnt.append(back_n) if f(back_n,cnt): return True return False if f(1,[1])==False: print(-1)