Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions jaykxo/week01/11382_꼬마_정민.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
input = sys.stdin.readline

A, B, C = map(int, input().split())

print(A + B + C)
6 changes: 6 additions & 0 deletions jaykxo/week01/2438_별_찍기 - 1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
input = sys.stdin.readline
N = int(input())

for i in range(N):
print("*" * (i + 1))
21 changes: 21 additions & 0 deletions jaykxo/week02/10798_세로읽기.py
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions jaykxo/week02/10807_개수_세기.py
Original file line number Diff line number Diff line change
@@ -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) # 결과 출력 (찾은 숫자의 개수)
8 changes: 8 additions & 0 deletions jaykxo/week02/10952_A+B-5.py
Original file line number Diff line number Diff line change
@@ -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)
21 changes: 21 additions & 0 deletions jaykxo/week03/10816_숫자_카드_2.py
Original file line number Diff line number Diff line change
@@ -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=" ") # 개수를 공백으로 구분하여 출력
16 changes: 16 additions & 0 deletions jaykxo/week03/1181_단어_정렬.py
Original file line number Diff line number Diff line change
@@ -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)
60 changes: 60 additions & 0 deletions jaykxo/week03/1920_수_찾기.py
Original file line number Diff line number Diff line change
@@ -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"));
13 changes: 13 additions & 0 deletions jaykxo/week03/2750_수_정렬하기.py
Original file line number Diff line number Diff line change
@@ -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)