K

@kimjuha19

도서관 대출 포인트 시스템

Python
4 months ago
p=13 n=10 total = p + n coupon = 0 point = 0 coupon = total // 15 point = total % 15 print(coupon,point)

로또 당첨 확인

Python
4 months ago
win_nums = [1, 2, 3, 4, 5, 6] my_nums = [[1, 2, 3, 10, 11, 12], [7, 8, 9, 10, 11, 12]] win_set = set(win_nums) result = [] for nums in my_nums: count = len(win_set & set(nums)) result.append(count)

달력 날짜 계산

Python
4 months ago
M = 3 D = 1 month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] days = sum(month_days[:M-1]) + D print(days)

비밀번호 보안 검사

Python
4 months ago
pw = "Python123" has_lower = False has_upper = False has_digit = False for ch in pw: if ch.islower(): has_lower = True elif ch.isupper():

몸무게 변화 점수

Python
4 months ago
weight = [60, 58, 59, 57] D = 4 A = 10 score = A for i in range(1, D): if weight[i] < weight[i-1]: score += 1 elif weight[i] > weight[i-1]:

로봇의 이동

Python
4 months ago
r, c = 0, 0 moves = ['U', 'U', 'R', 'L', 'D'] for move in moves: new_r, new_c = r, c if move == 'U': new_r += 1 elif move == 'D': new_r -= 1

시험 부정행위 탐지

Python
4 months ago
ans1 = [1, 2, 3, 4, 5, 2, 1] ans2 = [5, 2, 3, 4, 5, 3, 1] count = 0 answer = False for i in range(len(ans1)): if ans1[i] == ans2[i]: count += 1 if count >= 4: answer = True

헬스장 출입 제한

Python
4 months ago
members = {"김철수":"오전권", "이영희":"오후권"} answer = [] time = 15 for name, ticket in members.items(): if ticket == "오전권": if not (6 <= time < 12): answer.append(name) elif ticket == "오후권": if not (12 <= time < 18):

수영장 레인 배정

Python
4 months ago
participants = ["김철수:자유형", "이영희:평영", "박지민:자유형", "최하늘:접영"] answer = [] for p in participants: if "자유형" in p: name = p.split(":")[0] answer.append(name) answer.sort()

주식 매수 타임

Python
4 months ago
prices = [7, 1, 5, 3, 6, 4] min_price = prices[0] max_profit = 0 for price in prices: if price < min_price: min_price = price elif price - min_price > max_profit: max_profit = price - min_price

택배 차량의 최적 적재

Python
4 months ago
limit = 50 boxes = [10, 25, 30, 5, 15] boxes.sort(reverse=True) total_weight = 0 count = 0 for box in boxes: if total_weight + box <= limit:

마라톤 페이스 조절 분석

Python
4 months ago
records = [10, 9, 8, 7, 11, 10, 9, 8] count = 0 for i in range(3, len(records)): if records[i-3] > records[i-2] > records[i-1] > records[i]: count += 1 print(count)

스마트 카페의 스탬프 및 쿠폰 시스템

Python
4 months ago
s = 8 n = 15 coupon = 0 stamp = 0 total = 0 total = s + n coupon = total // 10 stamp = total % 10

색종이

Python
4 months ago
def solution(paper): grid = [[0]*100 for _ in range(100)] for x, y in paper: for i in range(x, x+10): for j in range(y, y+10): grid[i][j] = 1 return sum(sum(row) for row in grid)

폭탄돌리기

Python
4 months ago
def solution(n, arr): i = 0 total = 0 while True: total += arr[i] if total >= n: return i + 1

이진법

Python
4 months ago
def solution(n): count = 0 while n & 1: count += 1 n >>= 1 return count n = 175

수줄이기

Python
4 months ago
def solution(n): while n > 10: s = 0 a = n while a > 0: s += a % 10 a //= 10 n = s

달력

Python
4 months ago
def solution(M, D): month_days = [31,28,31,30,31,30,31,31,30,31,30,31] days = sum(month_days[:M-1]) + D return days M = 3 D = 5 ret = solution(M, D)

비밀번호

Python
4 months ago
def solution(pw): has_lower = has_upper = has_digit = False for ch in pw: if 'a' <= ch <= 'z': has_lower = True if 'A' <= ch <= 'Z': has_upper = True if '0' <= ch <= '9': has_digit

몸무게

Python
4 months ago
def solution(weight, D, A): mood = A for i in range(1, D): diff = weight[i] - weight[i-1] if diff > 0: mood -= diff * 10 elif diff < 0: mood += abs(diff) * 2