diff --git "a/minjeong/DFSBFS/2025-06-09-[\353\260\261\354\244\200]-#12851-\354\210\250\353\260\224\352\274\255\354\247\2102.py" "b/minjeong/DFSBFS/2025-06-09-[\353\260\261\354\244\200]-#12851-\354\210\250\353\260\224\352\274\255\354\247\2102.py" new file mode 100644 index 0000000..454d1d7 --- /dev/null +++ "b/minjeong/DFSBFS/2025-06-09-[\353\260\261\354\244\200]-#12851-\354\210\250\353\260\224\352\274\255\354\247\2102.py" @@ -0,0 +1,31 @@ +import sys +from collections import deque + +input = sys.stdin.readline + +MAX = 100000 +N, K = map(int, input().split()) +dist = [-1] * (MAX + 1) +ways = [0] * (MAX + 1) + +queue = deque([N]) +dist[N] = 0 +ways[N] = 1 + +while queue: + x = queue.popleft() + + for nx in (x - 1, x + 1, x * 2): + # 범위 내 + if 0 <= nx <= MAX: + # 아직 방문하지 않은 위치 + if dist[nx] == -1: + dist[nx] = dist[x] + 1 # 현재 걸린 시간 +1 초 + ways[nx] = ways[x] # 이전 위치에서 오는 방법의 수 가져오기 + queue.append(nx) + # 이미 방문했지만, 같은 시간에 다시 도달한 경우 + elif dist[nx] == dist[x] + 1: + ways[nx] += ways[x] # 기존 방법 수 + 새로운 경로 수 + +print(dist[K]) +print(ways[K]) \ No newline at end of file diff --git "a/minjeong/DFSBFS/2025-06-14-[\353\260\261\354\244\200]-#1697-\354\210\250\353\260\224\352\274\255\354\247\210.py" "b/minjeong/DFSBFS/2025-06-14-[\353\260\261\354\244\200]-#1697-\354\210\250\353\260\224\352\274\255\354\247\210.py" new file mode 100644 index 0000000..073e461 --- /dev/null +++ "b/minjeong/DFSBFS/2025-06-14-[\353\260\261\354\244\200]-#1697-\354\210\250\353\260\224\352\274\255\354\247\210.py" @@ -0,0 +1,20 @@ +import sys +from collections import deque +input = sys.stdin.readline + +MAX = 100000 +N, K = map(int, input().split()) + +visited = [0] * (MAX+1) +queue = deque([N]) + +while queue: + current = queue.popleft() + if current == K: + break + for nx in (current + 1, current - 1, current * 2): + if 0 <= nx <= MAX and not visited[nx]: + visited[nx] = visited[current] + 1 + queue.append(nx) + +print(visited[K]) \ No newline at end of file diff --git "a/minjeong/Simulation/2025-06-14-[\353\260\261\354\244\200]-#20546-\352\270\260\354\240\201\354\235\230\353\247\244\353\247\244\353\262\225.py" "b/minjeong/Simulation/2025-06-14-[\353\260\261\354\244\200]-#20546-\352\270\260\354\240\201\354\235\230\353\247\244\353\247\244\353\262\225.py" new file mode 100644 index 0000000..296ee2e --- /dev/null +++ "b/minjeong/Simulation/2025-06-14-[\353\260\261\354\244\200]-#20546-\352\270\260\354\240\201\354\235\230\353\247\244\353\247\244\353\262\225.py" @@ -0,0 +1,38 @@ +import sys +import math +input = sys.stdin.readline + +money = int(input()) +prices = list(map(int, input().split())) + +# 준현이 (BNP) +jh_cash = money +jh_stock = 0 +for price in prices: + if jh_cash >= price: + jh_stock += jh_cash // price + jh_cash = jh_cash % price +jh_total = jh_cash + jh_stock * prices[-1] + +# 성민이 (TIMING) +sm_cash = money +sm_stock = 0 +for i in range(3, 14): + # 3일 연속 상승 + if prices[i-3] < prices[i-2] < prices[i-1]: + sm_cash += sm_stock * prices[i] + sm_stock = 0 + # 3일 연속 하락 + elif prices[i-3] > prices[i-2] > prices[i-1]: + can_buy = sm_cash // prices[i] + sm_stock += can_buy + sm_cash -= can_buy * prices[i] +sm_total = sm_cash + sm_stock * prices[-1] + +# 결과 출력 +if jh_total > sm_total: + print("BNP") +elif jh_total < sm_total: + print("TIMING") +else: + print("SAMESAME")