結果
| 問題 |
No.2241 Reach 1
|
| ユーザー |
|
| 提出日時 | 2023-03-10 22:08:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 391 bytes |
| コンパイル時間 | 148 ms |
| コンパイル使用メモリ | 82,532 KB |
| 実行使用メモリ | 54,304 KB |
| 最終ジャッジ日時 | 2024-09-18 04:22:05 |
| 合計ジャッジ時間 | 2,230 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 22 |
ソースコード
import sys
sys.setrecursionlimit(5*10**5)
dic = {}
def dfs(x):
if x in dic:
return dic[x]
if x == 1:
return 0
cand = 10**10
now = x
if x%2:
cand = min(cand,1+dfs(x+1))
else:
while now%2 == 0:
now //= 2
cand = min(cand,1+dfs(now))
dic[x] = cand
return cand
print(dfs(int(input())))
# print(dic)