From a799e31a01adc7c5c316c41c9407cbeaa79bd44b Mon Sep 17 00:00:00 2001 From: hwangjaehee Date: Mon, 26 May 2025 22:18:07 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=EB=8B=A8=EC=96=B4=EB=92=A4=EC=A7=91?= =?UTF-8?q?=EA=B8=B02=20/=201h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hwangjaehee.py" | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 "week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" diff --git "a/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" new file mode 100644 index 00000000..7987b686 --- /dev/null +++ "b/week7/implementation/\353\213\250\354\226\264\353\222\244\354\247\221\352\270\2602/hwangjaehee.py" @@ -0,0 +1,23 @@ +import sys +S = sys.stdin.readline().strip() + ' ' # 마지막에 공백 더하기 +stack = [] +result = '' +cnt = 0 # 괄호 안에 있는지 여부 +for i in S : + if i == '<' : # <를 만나면 + cnt = 1 # 지금 괄호 안에 있음 표시 + for _ in range(len(stack)): #괄호 만나기 이전 stack 비우고 다 뒤집어서 더하기 + result += stack.pop() + stack.append(i) + + if i == '>' : # >를 만나면 + cnt = 0 # 지금 괄호 빠져 나왔음 표시 + for _ in range(len(stack)): # 괄호 안에 있는 애들은 뒤집지 않고 더하기 + result += stack.pop(0) + + if i == ' ' and cnt == 0: # 공백을 만나고 괄호 밖에 있다면 + stack.pop() # 공백 빼기 + for _ in range(len(stack)): # 뒤집어서 더하기 + result += stack.pop() + result += ' ' +print(result) \ No newline at end of file From baca94e98be93930f8cf535539de15ddeeb989e8 Mon Sep 17 00:00:00 2001 From: hwangjaehee Date: Mon, 26 May 2025 22:20:22 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=A0=95=EB=A6=AC=20/=20?= =?UTF-8?q?1h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hwangjaehee.py" | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 "week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" diff --git "a/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" new file mode 100644 index 00000000..33f042a2 --- /dev/null +++ "b/week7/implementation/\355\214\214\354\235\274\354\240\225\353\246\254/hwangjaehee.py" @@ -0,0 +1,11 @@ +N = int(input()) +dic = {} # 확장자를 담아줄 딕셔너리 +for i in range(N): + _, extend = input().split('.') # .기준으로 문자열 분리 + if extend in dic: # 딕셔너리에 확장자가 있다면 개수를 추가 + dic[extend] += 1 + else: # 없다면 새로 등록 + dic[extend] = 1 + +for key in sorted(dic.keys()): # 딕셔너리의 key를 오름차순 정렬 + print(key, dic[key]) \ No newline at end of file From 5746bce6d3eab0f93f3ce41cbaaa9b9ae52ac407 Mon Sep 17 00:00:00 2001 From: hwangjaehee Date: Mon, 26 May 2025 22:21:42 +0900 Subject: [PATCH 3/4] ZOAC3 / 1h --- week7/simulation/ZOAC3/hwangjaehee.py | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 week7/simulation/ZOAC3/hwangjaehee.py diff --git a/week7/simulation/ZOAC3/hwangjaehee.py b/week7/simulation/ZOAC3/hwangjaehee.py new file mode 100644 index 00000000..5ced070a --- /dev/null +++ b/week7/simulation/ZOAC3/hwangjaehee.py @@ -0,0 +1,42 @@ +from sys import stdin + +l, r = map(str, stdin.readline().rstrip().split()) +string = stdin.readline().rstrip() + +keyboard = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] +mo = 'yuiophjklbnm' +xl, yl, xr, yr = None, None, None, None + +for i in range(len(keyboard)): + if l in keyboard[i]: + xl, yl = i, keyboard[i].index(l) + + if r in keyboard[i]: + xr, yr = i, keyboard[i].index(r) + +ans = 0 +for s in string: + ans += 1 + if s in mo: + for i in range(len(keyboard)): + if s in keyboard[i]: + nx = i + ny = keyboard[i].index(s) + + ans += abs(xr - nx) + abs(yr - ny) + + xr, yr = nx, ny + break + + else: + for i in range(len(keyboard)): + if s in keyboard[i]: + nx = i + ny = keyboard[i].index(s) + + ans += abs(xl - nx) + abs(yl - ny) + + xl, yl = nx, ny + break + +print(ans) \ No newline at end of file From 924e3111780744e051553cad8eb14a095b75b126 Mon Sep 17 00:00:00 2001 From: hwangjaehee Date: Wed, 28 May 2025 17:25:35 +0900 Subject: [PATCH 4/4] ZOAC3 / 1h --- week7/simulation/ZOAC3/hwangjaehee.py | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/week7/simulation/ZOAC3/hwangjaehee.py b/week7/simulation/ZOAC3/hwangjaehee.py index 5ced070a..38549ae1 100644 --- a/week7/simulation/ZOAC3/hwangjaehee.py +++ b/week7/simulation/ZOAC3/hwangjaehee.py @@ -1,33 +1,39 @@ from sys import stdin -l, r = map(str, stdin.readline().rstrip().split()) -string = stdin.readline().rstrip() +l, r = map(str, stdin.readline().rstrip().split()) # 왼손과 오른손 검지손가락의 초기 위치 문자 읽기 +string = stdin.readline().rstrip() #입력해야 할 문자열을 읽기 keyboard = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm'] -mo = 'yuiophjklbnm' -xl, yl, xr, yr = None, None, None, None +mo = 'yuiophjklbnm' #모음 리스트 +xl, yl, xr, yr = None, None, None, None #왼손좌표행렬, 오른손 좌표 행렬(초기화) +# 키보드 배열을 순회하며 왼손과 오른손 검지손가락의 초기 위치 문자에 해당하는 좌표 찾기기 for i in range(len(keyboard)): - if l in keyboard[i]: + # 현재 행 keyboard[i]에 왼손 초기 위치 문자 l이 있는지 확인 + if l in keyboard[i]: # 있다면 해당 행 i와 해당 문자의 열 인덱스를 찾아 xl, yl에 저장합니다. xl, yl = i, keyboard[i].index(l) - if r in keyboard[i]: + # 오른손 초기 위치 문자 r이 있는지 확인 + if r in keyboard[i]: # 있다면 해당 행 i와 해당 문자의 열 인덱스를 찾아 xr, yr에 저장 xr, yr = i, keyboard[i].index(r) -ans = 0 +ans = 0 # 총 걸린 시간을 저장할 변수를 초기화 for s in string: - ans += 1 + ans += 1 # 각 문자를 누르는 데 기본적으로 1만큼의 시간이 소요 + + #오른손으로 눌러야 하는 경우(모음) if s in mo: for i in range(len(keyboard)): - if s in keyboard[i]: + if s in keyboard[i]: # 문있다면 해당 행 i와 해당 문자의 열 인덱스를 nx, ny에 저장 nx = i ny = keyboard[i].index(s) - + # 맨해튼 거리 = |행 차이| + |열 차이| ans += abs(xr - nx) + abs(yr - ny) xr, yr = nx, ny - break + break # 문자를 찾았으므로 내부 루프는 중단하고 다음 문자로 넘어가기기 + #왼손으로 눌러야 하는 경우 else: for i in range(len(keyboard)): if s in keyboard[i]: