diff --git "a/jaykxo/week01/11382_\352\274\254\353\247\210_\354\240\225\353\257\274.py" "b/jaykxo/week01/11382_\352\274\254\353\247\210_\354\240\225\353\257\274.py" new file mode 100644 index 0000000..80b02f3 --- /dev/null +++ "b/jaykxo/week01/11382_\352\274\254\353\247\210_\354\240\225\353\257\274.py" @@ -0,0 +1,6 @@ +import sys +input = sys.stdin.readline + +A, B, C = map(int, input().split()) + +print(A + B + C) \ No newline at end of file diff --git "a/jaykxo/week01/2438_\353\263\204_\354\260\215\352\270\260 - 1.py" "b/jaykxo/week01/2438_\353\263\204_\354\260\215\352\270\260 - 1.py" new file mode 100644 index 0000000..9b17e30 --- /dev/null +++ "b/jaykxo/week01/2438_\353\263\204_\354\260\215\352\270\260 - 1.py" @@ -0,0 +1,6 @@ +import sys +input = sys.stdin.readline +N = int(input()) + +for i in range(N): + print("*" * (i + 1)) \ No newline at end of file diff --git "a/jaykxo/week02/10798_\354\204\270\353\241\234\354\235\275\352\270\260.py" "b/jaykxo/week02/10798_\354\204\270\353\241\234\354\235\275\352\270\260.py" new file mode 100644 index 0000000..6a57446 --- /dev/null +++ "b/jaykxo/week02/10798_\354\204\270\353\241\234\354\235\275\352\270\260.py" @@ -0,0 +1,21 @@ +import sys +input = sys.stdin.readline + +# 1) 5줄 입력받아 리스트에 저장 +lines = [] +for _ in range(5): + line = input().strip() # 한 줄 입력받고 개행 제거 + lines.append(line) + +# 2) 가장 긴 문자열의 길이 구하기 +max_len = max(len(line) for line in lines) + +# 3) 세로로 읽기: 열을 기준으로 각 줄을 돌며 문자 추가 +result = "" +for c in range(max_len): # 열(column) 기준 + for r in range(len(lines)): # 행(row) 기준 + if c < len(lines[r]): # 해당 줄에 문자가 존재하면 + result += lines[r][c] + +# 4) 결과 문자열 출력 +print(result) \ No newline at end of file diff --git "a/jaykxo/week02/10807_\352\260\234\354\210\230_\354\204\270\352\270\260.py" "b/jaykxo/week02/10807_\352\260\234\354\210\230_\354\204\270\352\270\260.py" new file mode 100644 index 0000000..a8999a5 --- /dev/null +++ "b/jaykxo/week02/10807_\352\260\234\354\210\230_\354\204\270\352\270\260.py" @@ -0,0 +1,14 @@ +import sys +input = sys.stdin.readline + +N = int(input()) # 숫자 개수 입력 받기 +num = list(map(int, input().split())) # 숫자 리스트 입력 받기 +v = int(input()) # 찾을 숫자 입력 받기 + +count = 0 # 찾은 숫자 개수 초기화 + +for i in range(N): + if num[i] == v : # 현재 숫자가 찾는 숫자와 같은지 확인 + count += 1 # 같으면 개수 증가 + +print(count) # 결과 출력 (찾은 숫자의 개수) \ No newline at end of file diff --git a/jaykxo/week02/10952_A+B-5.py b/jaykxo/week02/10952_A+B-5.py new file mode 100644 index 0000000..7fdf9f0 --- /dev/null +++ b/jaykxo/week02/10952_A+B-5.py @@ -0,0 +1,8 @@ +import sys +input = sys.stdin.readline + +while True: + a, b = map(int, input().split()) + if a == 0 and b == 0: # 종료 조건 + break + print(a + b) \ No newline at end of file diff --git "a/jaykxo/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" "b/jaykxo/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" new file mode 100644 index 0000000..b5f8222 --- /dev/null +++ "b/jaykxo/week03/10816_\354\210\253\354\236\220_\354\271\264\353\223\234_2.py" @@ -0,0 +1,21 @@ +# 10816 숫자 카드 2 +# 메모리: 117520 KB, 시간: 1384 ms + + +import bisect # 이분 탐색을 내장 함수로 제공 +import sys +input = sys.stdin.readline + +N = int(input()) +A = list(map(int, input().split())) +A.sort() # 이분 탐색을 위한 정렬 +M = int(input()) +K = list(map(int, input().split())) + +# bisect_left, bisect_right 내장 함수를 이용하여 구간(개수) 계산 +for t in K: + left = bisect.bisect_left(A, t) # t가 처음 등장하는 인덱스 + right = bisect.bisect_right(A, t) # t가 마지막으로 끝난 뒤 인덱스 + count = (right - left) # 두 위치 차이가 t의 개수 + + print(count, end=" ") # 개수를 공백으로 구분하여 출력 \ No newline at end of file diff --git "a/jaykxo/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" "b/jaykxo/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" new file mode 100644 index 0000000..eb00c24 --- /dev/null +++ "b/jaykxo/week03/1181_\353\213\250\354\226\264_\354\240\225\353\240\254.py" @@ -0,0 +1,16 @@ +# 1181 단어 정렬 +# 메모리: 37692 KB, 시간: 80 ms + +import sys +input = sys.stdin.readline + +N = int(input()) + +# 단어들을 입력받아 리스트에 저장 +words = [input().strip() for _ in range(N)] + +# 중복 제거 후 길이 → 사전순으로 정렬 +words = sorted(set(words), key=lambda x: (len(x), x)) + +for word in words: + print(word) \ No newline at end of file diff --git "a/jaykxo/week03/1920_\354\210\230_\354\260\276\352\270\260.py" "b/jaykxo/week03/1920_\354\210\230_\354\260\276\352\270\260.py" new file mode 100644 index 0000000..c5a0906 --- /dev/null +++ "b/jaykxo/week03/1920_\354\210\230_\354\260\276\352\270\260.py" @@ -0,0 +1,60 @@ +# 1920 수 찾기 +# 메모리: 50412 KB, 시간: 504 ms + +import sys +input = sys.stdin.readline +from typing import Any, Sequence + +N = int(input()) +A = list(map(int, input().split())) +A.sort() # 이분 탐색을 위해 반드시 정렬 필요 +M = int(input()) +K = list(map(int, input().split())) + +def bin_search(A: Sequence, key: Any): + pl = 0 + pr = len(A) - 1 # 탐색 범위 오른쪽 끝 (리스트 마지막 인덱스) + + while pl <= pr: + pc = (pl + pr) // 2 # 현재 탐색 구간의 중간 인덱스 + + if A[pc] == key: + print("1") + return pc # 찾으면 인덱스 반환 (실제 문제에서는 출력만 필요) + + elif A[pc] < key: + pl = pc + 1 # 찾는 값이 더 크면 오른쪽 반으로 탐색 범위 좁힘 + else: + pr = pc - 1 # 찾는 값이 더 작으면 왼쪽 반으로 탐색 범위 좁힘 + + print("0") # 끝까지 못 찾으면 0 출력 + +# 찾을 숫자들을 하나씩 이분 탐색 실행 +for key in K: + bin_search(A, key) + + +############ 번외 ############ +# node.js 제출 버전 +# 메모리: 39068 KB, 시간: 324 ms + +# const fs = require("fs"); +# const input = fs.readFileSync(0).toString().trim().split("\n"); + +# const N = Number(input[0]); +# const A = input[1].split(" ").map(Number).sort((a, b) => a - b); +# const M = Number(input[2]); +# const targets = input[3].split(" ").map(Number); + +# function binarySearch(arr, target) { +# let start = 0, end = arr.length - 1; +# while (start <= end) { +# let mid = Math.floor((start + end) / 2); +# if (arr[mid] === target) return 1; +# if (arr[mid] < target) start = mid + 1; +# else end = mid - 1; +# } +# return 0; +# } + +# console.log(targets.map(t => binarySearch(A, t)).join("\n")); \ No newline at end of file diff --git "a/jaykxo/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" "b/jaykxo/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" new file mode 100644 index 0000000..fe39357 --- /dev/null +++ "b/jaykxo/week03/2750_\354\210\230_\354\240\225\353\240\254\355\225\230\352\270\260.py" @@ -0,0 +1,13 @@ +# 2750 수 정렬하기 +# 메모리: 32412 KB, 시간: 40 ms + +import sys +input = sys.stdin.readline + +N = int(input()) +A = [int(input()) for _ in range(N)] + +A.sort() # 리스트 오름차순 정렬 + +for num in A: + print(num) \ No newline at end of file