結果
問題 | No.642 Two Operations No.1 |
ユーザー |
![]() |
提出日時 | 2022-05-06 18:50:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 296 bytes |
コンパイル時間 | 64 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-05 19:55:16 |
合計ジャッジ時間 | 953 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 |
ソースコード
from sys import setrecursionlimit setrecursionlimit(10**6) def dfs(x): if x in dic: return dic[x] if x % 2 == 0: dic[x] = dfs(x//2) + 1 return dic[x] else: dic[x] = dfs(x+1) + 1 return dic[x] N = int(input()) dic = {} dic[1] = 0 print(dfs(N))