From b64a02358b8f567f45d7b7f87dbdf464cc030c20 Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Wed, 24 Sep 2025 12:20:15 +0900 Subject: [PATCH 1/4] =?UTF-8?q?Solved:=202750=20=EC=88=98=20=EC=A0=95?= =?UTF-8?q?=EB=A0=AC=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...25\353\240\254\355\225\230\352\270\260.py" | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 "INSEA-99/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" diff --git "a/INSEA-99/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" "b/INSEA-99/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" new file mode 100644 index 0000000..b77422b --- /dev/null +++ "b/INSEA-99/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" @@ -0,0 +1,22 @@ +# 시간(ms) : 92 +# 공간(KB) : 109412 +# +# 공유 : +# 1) * 는 리스트, 튜플, 문자열 등의 요소를 함수 인자로 풀어서 전달 +# ex) +# nums = [1, 2, 3] +# print(*nums) = print(1, 2, 3) +# +# 2) print()의 sep 매개변수 (defult = ' ') +# ex) +# print('a', 'b', 'c') +# -> 'a' 'b' 'c' +# print('a', 'b', 'c', sep='!') +# -> 'a'!'b'!'c' + + +import sys +input = sys.stdin.readline + +nums = [int(sys.stdin.readline().strip()) for _ in range(int(input()))] +print(*sorted(nums), sep='\n') From b967978f7fb05f38562c3a73bf52a04e98828b6a Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Wed, 24 Sep 2025 12:27:33 +0900 Subject: [PATCH 2/4] =?UTF-8?q?Solved:=201181=20=EB=8B=A8=EC=96=B4=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._\353\213\250\354\226\264_\354\240\225\353\240\254.py" | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 "INSEA-99/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" diff --git "a/INSEA-99/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" "b/INSEA-99/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" new file mode 100644 index 0000000..382fb9f --- /dev/null +++ "b/INSEA-99/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" @@ -0,0 +1,8 @@ +# 시간(ms) : 156 +# 공간(KB) : 115768 + +import sys +input = sys.stdin.readline + +nums = set([sys.stdin.readline().strip() for _ in range(int(input()))]) +print(*sorted(nums, key=lambda x : (len(x), x)), sep='\n') From eed8584e5c9ebba28367daa6b2f2a152a79d214a Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Wed, 24 Sep 2025 12:39:26 +0900 Subject: [PATCH 3/4] =?UTF-8?q?Solved:=201920=20=EC=88=98=20=EC=B0=BE?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._\354\210\230_\354\260\276\352\270\260.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "INSEA-99/week03/1920_\354\210\230_\354\260\276\352\270\260.py" diff --git "a/INSEA-99/week03/1920_\354\210\230_\354\260\276\352\270\260.py" "b/INSEA-99/week03/1920_\354\210\230_\354\260\276\352\270\260.py" new file mode 100644 index 0000000..2ffba79 --- /dev/null +++ "b/INSEA-99/week03/1920_\354\210\230_\354\260\276\352\270\260.py" @@ -0,0 +1,28 @@ +# 시간(ms) : 216 +# 공간(KB) : 137716 +# +# 공유 : +# - 파이썬에서 문자(str)와 정수(int)는 비교 방식이 다르므로 정렬 시 주의 +# ex) +# 2 < 10 +# '2' > '10' # 문자열 "2"의 첫 글자 '2'와 "10"의 첫 글자 '1'을 비교 + +import sys +input = sys.stdin.readline + +def bs(arr, target) : + left = 0 + right = len(arr) - 1 + + while(left <= right) : + mid = (left + right) // 2 + if(arr[mid] < target) : left = mid + 1 + elif(arr[mid] > target) : right = mid - 1 + else : return 1 + return 0 + +input() +nums = sorted(list(map(int, input().strip().split()))) +input() +for t in list(map(int, input().strip().split())): + print(bs(nums, t)) From 15cebb12cf1e166caa477e396b1355498fab137a Mon Sep 17 00:00:00 2001 From: INSEA-99 Date: Fri, 26 Sep 2025 12:08:24 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Solved:=2010816=20=EC=88=AB=EC=9E=90=20?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...354\236\220_\354\271\264\353\223\234_2.py" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 "INSEA-99/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" diff --git "a/INSEA-99/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" "b/INSEA-99/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" new file mode 100644 index 0000000..5db2be2 --- /dev/null +++ "b/INSEA-99/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" @@ -0,0 +1,44 @@ +# Dict 풀이 시간: +# 시간(ms) : 720 +# 공간(KB) : 266652 +# +# Counter 풀이 시간: +# 시간(ms) : 672 +# 공간(KB) : 266708 +# +# 공유 : +# - Counter는 collections 모듈에 포함된 dict의 특수 버전. 내부는 사실상 dict 기반이지만, 추가 메서드와 연산자 지원 + + +import sys +from collections import Counter +input = sys.stdin.readline + + +# 1. dictionary 사용 +input() +nums = list(input().strip().split()) # 숫자 카드 입력 받기 + +dic = {} +for n in nums : # dictionary로 입력 받은 숫자 카드 개수 카운드 + dic[n] = dic.get(n, 0) + 1 + +input() +ans = [] +for m in list(input().strip().split()) : # dic에서 숫자 카드 개수 가져오기 + ans.append(dic.get(m, 0)) +print(*ans) + + + +# 2. Counter 사용 +input() +nums = list(input().strip().split()) # 숫자 카드 입력 받기 +counter = Counter(nums) + +input() +ans = [] +for m in list(input().strip().split()) : # dic에서 숫자 카드 개수 가져오기 + ans.append(counter[m]) +print(*ans) +