From ba9b766fe1c59b4f81b48a492ace2442b4ba7ac1 Mon Sep 17 00:00:00 2001 From: SeryeongK <99seryoung@naver.com> Date: Wed, 9 Apr 2025 19:41:36 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[#38]=20=EB=8D=94=EB=A7=B5=EA=B2=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 정확성 3개 불불 --- .../\353\215\224\353\247\265\352\262\214.py" | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 "Seryeong/Programmers/Lv2/\353\215\224\353\247\265\352\262\214.py" diff --git "a/Seryeong/Programmers/Lv2/\353\215\224\353\247\265\352\262\214.py" "b/Seryeong/Programmers/Lv2/\353\215\224\353\247\265\352\262\214.py" new file mode 100644 index 0000000..fcb7178 --- /dev/null +++ "b/Seryeong/Programmers/Lv2/\353\215\224\353\247\265\352\262\214.py" @@ -0,0 +1,19 @@ +# 정확성: 74.2 +# 효율성: 16.1 +# 합계: 90.3 / 100.0 +# import heapq +# def solution(scoville, K): +# answer = 0 +# heapq.heapify(scoville) +# while len(scoville) > 1: +# min1 = heapq.heappop(scoville) +# if min1 >= K: +# break +# min2 = heapq.heappop(scoville) + +# scoville.append(min1 + min2 * 2) +# answer += 1 + +# if scoville[0] < K: +# return -1 +# return answer From a86099f320351a81acbe77b7d49e8c2db5dd2bfb Mon Sep 17 00:00:00 2001 From: SeryeongK <99seryoung@naver.com> Date: Wed, 9 Apr 2025 19:48:27 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[#40]=20K=EB=B2=88=EC=A7=B8=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Lv1/K\353\262\210\354\247\270\354\210\230.py" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "Seryeong/Programmers/Lv1/K\353\262\210\354\247\270\354\210\230.py" diff --git "a/Seryeong/Programmers/Lv1/K\353\262\210\354\247\270\354\210\230.py" "b/Seryeong/Programmers/Lv1/K\353\262\210\354\247\270\354\210\230.py" new file mode 100644 index 0000000..eac456d --- /dev/null +++ "b/Seryeong/Programmers/Lv1/K\353\262\210\354\247\270\354\210\230.py" @@ -0,0 +1,8 @@ +def solution(array, commands): + answer = [] + for command in commands: + temp = array + temp = temp[command[0]-1:command[1]] + temp.sort() + answer.append(temp[command[2]-1]) + return answer From 915f92766b46b0d9be3cfd055a4895e7772c0dac Mon Sep 17 00:00:00 2001 From: SeryeongK <99seryoung@naver.com> Date: Mon, 21 Apr 2025 20:36:41 +0900 Subject: [PATCH 3/5] [#54] 17626 Four Squares --- Seryeong/Baekjoon/DP/17626.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Seryeong/Baekjoon/DP/17626.py diff --git a/Seryeong/Baekjoon/DP/17626.py b/Seryeong/Baekjoon/DP/17626.py new file mode 100644 index 0000000..89cea93 --- /dev/null +++ b/Seryeong/Baekjoon/DP/17626.py @@ -0,0 +1,24 @@ +# 17626 Four Squares +import sys + +num = int(sys.stdin.readline()) +DP = [0] * (num + 1) + +i = 1 +while i**2 <= num: + DP[i**2] = 1 # 제곱수는 개수가 1개 + i += 1 + +for i in range(1, num + 1): + if DP[i] != 0: # 제곱수이면 패스(어차피 최소이기 때문에) + continue + + j = 1 + while j*j <= i: # 아직 개수를 안 셌을 때 + if DP[i] == 0: + DP[i] = DP[i - j*j] + DP[j*j] # 제곱수 개수 합치기 + else: + DP[i] = min(DP[i], DP[i - j*j] + DP[j*j]) # 최소인 제곱수 개수로 업데이트 + j += 1 + +print(DP[-1]) From 9254d4cf7634789f3dbc9d9ad5d3c95d226774ad Mon Sep 17 00:00:00 2001 From: SeryeongK <99seryoung@naver.com> Date: Mon, 21 Apr 2025 21:10:06 +0900 Subject: [PATCH 4/5] [#53] 16953 A -> B --- Seryeong/Baekjoon/Greedy/16953.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Seryeong/Baekjoon/Greedy/16953.py diff --git a/Seryeong/Baekjoon/Greedy/16953.py b/Seryeong/Baekjoon/Greedy/16953.py new file mode 100644 index 0000000..22ff6da --- /dev/null +++ b/Seryeong/Baekjoon/Greedy/16953.py @@ -0,0 +1,21 @@ +# 16953 A -> B +import sys + +A, B = map(int, sys.stdin.readline().split()) + +cnt = 1 +while B != A: + if B % 2 == 0: # 2로 나누어질 때 + B = B // 2 + elif B % 10 == 1: # 뒷자리가 1로 끝날 때 + B = B // 10 + else: # 아무 연산도 안될 경우 + cnt = -1 + break + cnt += 1 + + if B == 0: # A를 B로 만들 수 없을 때 + cnt = -1 + break + +print(cnt) From ecb989ca9f8b82451f68176a50768c8b75646fff Mon Sep 17 00:00:00 2001 From: SeryeongK <99seryoung@naver.com> Date: Wed, 23 Apr 2025 21:34:59 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[#55]=2015787=20=EA=B8=B0=EC=B0=A8=EA=B0=80?= =?UTF-8?q?=20=EC=96=B4=EB=91=A0=EC=9D=84=20=ED=97=A4=EC=B9=98=EA=B3=A0=20?= =?UTF-8?q?=EC=9D=80=ED=95=98=EC=88=98=EB=A5=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Seryeong/Baekjoon/Implement/15787.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Seryeong/Baekjoon/Implement/15787.py diff --git a/Seryeong/Baekjoon/Implement/15787.py b/Seryeong/Baekjoon/Implement/15787.py new file mode 100644 index 0000000..9646eb1 --- /dev/null +++ b/Seryeong/Baekjoon/Implement/15787.py @@ -0,0 +1,21 @@ +# 15787 기차가 어둠을 헤치고 은하수를 +import sys + +N, M = map(int, sys.stdin.readline().split()) + +seats = [[0] * 20 for _ in range(N)] +print(seats) +for _ in range(M): + command = sys.stdin.readline().split() + type = int(command[0]) + if type == 1: + if seats[command[1]][command[2]]: + seats[command[1]][command[2]] = 1 + elif type == 2: + if not seats[command[1]][command[2]]: + seats[command[1]][command[2]] = 0 + elif type == 3: + for i in range(20, -1): + seats[command[1]][i+1] = seats[command[1]][i] + +print(seats)