結果
| 問題 | No.2241 Reach 1 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-10 22:08:12 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 391 bytes |
| 記録 | |
| コンパイル時間 | 385 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 52,224 KB |
| 最終ジャッジ日時 | 2026-04-06 13:44:54 |
| 合計ジャッジ時間 | 2,156 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)