From 014f3657ba2e04db541b2aed14e5de75c6ebddf9 Mon Sep 17 00:00:00 2001 From: Minjeong Kim Date: Mon, 9 Jun 2025 23:46:29 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[BOJ]=20#12851.=20=EC=88=A8=EB=B0=94?= =?UTF-8?q?=EA=BC=AD=EC=A7=882=20/=20=EA=B3=A8=EB=93=9C4=20/=2040=EB=B6=84?= =?UTF-8?q?=20/=20=EC=8B=A4=ED=8C=A8=20->=20=ED=9E=8C=ED=8A=B8=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\353\260\224\352\274\255\354\247\2102.py" | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 "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" 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 From 067261308d1213d9afcc4ae722e0dfe316967044 Mon Sep 17 00:00:00 2001 From: Minjeong Kim Date: Fri, 13 Jun 2025 17:22:18 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[BOJ]=20#1697.=20=EC=88=A8=EB=B0=94?= =?UTF-8?q?=EA=BC=AD=EC=A7=88=20/=20=EC=8B=A4=EB=B2=841=20/=2020=EB=B6=84?= =?UTF-8?q?=20/=20=EC=84=B1=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...50\353\260\224\352\274\255\354\247\210.py" | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 "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" 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 From de7b95da66b45931604309609f8dab6038a2a63f Mon Sep 17 00:00:00 2001 From: Minjeong Kim Date: Sat, 14 Jun 2025 23:56:30 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[BOJ]=20#20546.=20=EA=B8=B0=EC=A0=81?= =?UTF-8?q?=EC=9D=98=20=EB=A7=A4=EB=A7=A4=EB=B2=95=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=845=20/=2040=EB=B6=84=20/=20=ED=9E=8C=ED=8A=B8,=EC=84=B1?= =?UTF-8?q?=EA=B3=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...30\353\247\244\353\247\244\353\262\225.py" | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 "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" 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..b1efb9d --- /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,55 @@ +import sys +import math +input = sys.stdin.readline + +""" +준형: BNP +- 첫 날 최대치를 사고, 절대 매도하지 않는다. + +성민: Timing +- 전량 매수 Or 전량매도 +- 3일 연속 가격이 전일대비 상승할 경우 -> 전량매도. (전일과 오늘의 주가가 동일한 것은 가격 상승 아님) +- 3일 연속 가격이 전일대비 하락하는 경우 -> 전량 매수. (전일과 오늘의 주가가 동일한 것은 가격 하락 아님) + +두 사람에게 주어진 현금은 동일하다.2021년 1월 14일의 자산이 더 많은 사람이 승리한다. +준현이가 이기면 BNP, 성민이가 이기면 TIMING, 동점일 경우 SAMESAME이다. +자산 = 현금 + 1월 14일 주가 * 주식 수 + +준형: 10주 -> 0 + 38 * 10 = 380 / 1주. 14원 +성민: +""" + +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") From 69dd1d0c22d25c4ae625177476833c6febbb5458 Mon Sep 17 00:00:00 2001 From: Minjeong Kim Date: Sat, 14 Jun 2025 23:56:52 +0900 Subject: [PATCH 4/4] =?UTF-8?q?docs:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\230\353\247\244\353\247\244\353\262\225.py" | 17 ----------------- 1 file changed, 17 deletions(-) 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" index b1efb9d..296ee2e 100644 --- "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" @@ -2,23 +2,6 @@ import math input = sys.stdin.readline -""" -준형: BNP -- 첫 날 최대치를 사고, 절대 매도하지 않는다. - -성민: Timing -- 전량 매수 Or 전량매도 -- 3일 연속 가격이 전일대비 상승할 경우 -> 전량매도. (전일과 오늘의 주가가 동일한 것은 가격 상승 아님) -- 3일 연속 가격이 전일대비 하락하는 경우 -> 전량 매수. (전일과 오늘의 주가가 동일한 것은 가격 하락 아님) - -두 사람에게 주어진 현금은 동일하다.2021년 1월 14일의 자산이 더 많은 사람이 승리한다. -준현이가 이기면 BNP, 성민이가 이기면 TIMING, 동점일 경우 SAMESAME이다. -자산 = 현금 + 1월 14일 주가 * 주식 수 - -준형: 10주 -> 0 + 38 * 10 = 380 / 1주. 14원 -성민: -""" - money = int(input()) prices = list(map(int, input().split()))