Skip to content

Commit

Permalink
2024-08-21 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
alstjr7437 committed Aug 21, 2024
1 parent 81f4b15 commit 802d6c9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
36 changes: 36 additions & 0 deletions alstjr7437/BFS/DSLR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from collections import deque
import sys

input = sys.stdin.readline

T = int(input())

def command(register, cmd):
if cmd == 0:
return ((register * 2) % 10000, "D")
elif cmd == 1:
return (9999 if register == 0 else register - 1, "S")
elif cmd == 2:
return (register % 1000 * 10 + register // 1000, "L")
elif cmd == 3:
return (register // 10 + (register % 10) * 1000, "R")

for _ in range(T):
A, B = map(int, input().split())

visited = [False] * 10000
visited[A] = True

queue = deque([(A, "")])
while queue:
cur, result = queue.popleft()

if cur == B:
print(result)
break

for i in range(4):
register, cmd = command(cur, i)
if not visited[register]:
visited[register] = True
queue.append((register, result + cmd))
7 changes: 4 additions & 3 deletions alstjr7437/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
| 27์ฐจ์‹œ | 2024.05.26 | ์šฐ์„ ์ˆœ์œ„ ํ | <a href="https://www.acmicpc.net/problem/7662">์ด์ค‘ ์šฐ์„ ์ˆœ์œ„ ํ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/198 |
| 28์ฐจ์‹œ | 2024.05.30 | ๋ธŒ๋ฃจํŠธ ํฌ์Šค | <a href="https://www.acmicpc.net/problem/6064">์นด์ž‰ ๋‹ฌ๋ ฅ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/203 |
| 29์ฐจ์‹œ | 2024.06.11 | ์ด๋ถ„ ํƒ์ƒ‰ | <a href="https://www.acmicpc.net/problem/2805">๋‚˜๋ฌด ์ž๋ฅด๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/210 |
| 30์ฐจ์‹œ | 2024.06.19 | ๋ฐฉ ๋ฒˆํ˜ธ | <a href="https://www.acmicpc.net/problem/1475">๊ตฌํ˜„</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/211 |
| 31์ฐจ์‹œ | 2024.06.19 | ๊ฒŒ์ž„ ๋งต ์ตœ๋‹จ๊ฑฐ๋ฆฌ | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/1844">BFS</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/218 |
| 32์ฐจ์‹œ | 2024.08.15 | ๊ณผ์ผ ํƒ•ํ›„๋ฃจ | <a href="https://www.acmicpc.net/problem/30804">ํˆฌ ํฌ์ธํ„ฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/230 |
| 30์ฐจ์‹œ | 2024.06.19 | ๊ตฌํ˜„ | <a href="https://www.acmicpc.net/problem/1475">๋ฐฉ ๋ฒˆํ˜ธ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/211 |
| 31์ฐจ์‹œ | 2024.06.19 | BFS | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/1844">๊ฒŒ์ž„ ๋งต ์ตœ๋‹จ๊ฑฐ๋ฆฌ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/218 |
| 32์ฐจ์‹œ | 2024.08.15 | ํˆฌ ํฌ์ธํ„ฐ | <a href="https://www.acmicpc.net/problem/30804">๊ณผ์ผ ํƒ•ํ›„๋ฃจ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/230 |
| 33์ฐจ์‹œ | 2024.08.21 | BFS | <a href="https://www.acmicpc.net/problem/9019">DSLR</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/236 |

0 comments on commit 802d6c9

Please sign in to comment.