Skip to content

Commit

Permalink
Merge pull request #113 from xxubin04/30-xxubin04
Browse files Browse the repository at this point in the history
30-xxubin04
  • Loading branch information
xxubin04 authored Feb 26, 2024
2 parents 94cbc2d + 0026d40 commit 513981e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions xxubin04/BFS/14562_νƒœκΆŒμ™•.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from collections import deque

input = open(0).readline


def BFS(c, x, y):
global ans
q = deque()
q.append((c, x, y))
while q:
cnt, t, o = q.popleft()
if t == o:
ans.append(cnt)
return ans
elif t * 2 <= o + 3:
q.append((cnt + 1, t * 2, o + 3))
q.append((cnt + 1, t + 1, o))
else:
q.append((cnt + 1, t + 1, o))


for i in range(n := int(input())):
ans = []
tae, opp = map(int, input().split())
print(min(BFS(0, tae, opp)))
3 changes: 2 additions & 1 deletion xxubin04/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
| 26μ°¨μ‹œ | 2024.02.05 | μ—λΌν† μŠ€ν…Œλ„€μŠ€μ˜ 체 | <a href="https://www.acmicpc.net/problem/4948">[4948]λ² λ₯΄νŠΈλž‘ 곡쀀</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/94 |
| 27μ°¨μ‹œ | 2024.02.08 | μˆ˜ν•™ | <a href="https://www.acmicpc.net/problem/2885">[2885]초콜릿 식사</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/98 |
| 28μ°¨μ‹œ | 2024.02.15 | 이진탐색 | <a href="https://www.acmicpc.net/problem/2805">[2805]λ‚˜λ¬΄ 자λ₯΄κΈ°</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/108 |
| 29μ°¨μ‹œ | 2024.02.19 | DP | <a href="https://www.acmicpc.net/problem/2502">[2502]λ–‘ λ¨ΉλŠ” ν˜Έλž‘μ΄</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/110 |
| 29μ°¨μ‹œ | 2024.02.19 | DP | <a href="https://www.acmicpc.net/problem/2502">[2502]λ–‘ λ¨ΉλŠ” ν˜Έλž‘μ΄</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/110 |
| 30μ°¨μ‹œ | 2024.02.22 | BFS | <a href="https://www.acmicpc.net/problem/14562">[14562]νƒœκΆŒμ™•</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-3/pull/113 |

0 comments on commit 513981e

Please sign in to comment.