K

@kimjuha19

주식 누적 수익 최대화

Python
3 months ago
profits = [10, -4, 3, 1, -5, 6] current = profits[0] max_profit = profits[0] for i in range(1, len(profits)): current = max(profits[i], current + profits[i]) max_profit = max(max_profit, current) print(max_profit)

음원 스트리밍 베스트 장르

Python
3 months ago
genres = ["classic", "pop", "classic", "pop"] plays = [500, 600, 150, 800] total = {} for i in range(len(genres)): genre = genres[i] play = plays[i] if genre in total:

스마트 팩토리 불량 부품 검출

Python
3 months ago
part1 = "{ [ ( ) ] }" part2 = "{ [ ( ] ) }" parts = [part1, part2] for part in parts: stack = [] pairs = {')': '(', '}': '{', ']': '['} is_valid = True

다중 IoT 기기 중앙 제어

Python
4 months ago
class Light: def __init__(self, location): self.location = location self.power = False def turn_on(self): self.power = True def turn_off(self): self.power = False

장바구니 및 복합 결제 로직

Python
4 months ago
class Product: def __init__(self, name, price): self.name = name self.price = price class Cart: def __init__(self): self.products = []

다형성을 활용한 객실 요금 산정

Python
4 months ago
class Hotel: def __init__(self, grade, room, day): self.grade = grade self.room = room self.day = day self.pay = 0 def parlor(self): if self.room == "Standard":

전직 및 스킬 포인트

Python
4 months ago
class Character: def __init__(self, level): self.level = level class Warrior(Character): def job_change(self): if self.level >= 10: print("전사로 전직 완료! 근력 스킬 포인트 5P가 지급되었습니다.") else:

지역별 차등 배송비 계산

Python
4 months ago
class Order: def __init__(self, price, region): self.price = price self.region = region def calculate_shipping(self): base = 3000 surcharge = 2000 if self.region == "제주도" else 0 if self.price >= 5000

인원별 테이블 자동 배정

Python
4 months ago
class Table: def __init__(self, name, capacity, status="비어있음"): self.name = name self.capacity = capacity self.status = status class Restaurant: def __init__(self, tables): self.tables = tables

토양 습도 자동 급수 시스템

Python
4 months ago
class Sensor: def __init__(self, humidity): self.humidity = humidity class WaterPump: def supply_water(self, amount): print(f"워터펌프를 가동하여 {amount}ml의 물을 공급합니다.")

도서 대여 및 연체료 계산

Python
4 months ago
class Book: def __init__(self, title): self.title = title self.is_rented = False class Library: def __init__(self): self.fine_per_day = 500

이체 한도 및 잔액 부족 관리

Python
4 months ago
class Account: def __init__(self, name, balance, limit): self.name = name self.balance = balance self.limit = limit def withdraw(self, amount): if amount > self.limit: exceed = amount - self.limit

배달 할증료 계산

Python
4 months ago
distance = int(input()) answer = 3000 if distance >= 3 or distance < 5: answer += answer * 20 // 100 elif distance >= 5: answer += answer * 50 // 100 print(answer)

로봇 청소기 배터리 소모

Python
4 months ago
move = ["상", "상", "우", "하"] answer = 2 for i in range(1,len(move)): if move[i] != move[i-1]: answer += 10 answer += 2 else: answer += 2

노래 가사 표절 검사

Python
4 months ago
song1 = ["love", "is", "all", "around", "me"] song2 = ["you", "is", "all", "around", "you"] answer = False count = 0 for i in range(len(song1)): if song1[i] == song2[i]: count += 1 if count >= 3:

박물관 야간 개장 제한

Python
4 months ago
members = {"최철수":"주간권", "김영희":"야간권"} answer = [] time = 17 for name, ticket in members.items(): if ticket == "주간권": if not (9 <= time <= 17): answer.append(name) elif ticket == "야간권": if not (18 <= time <= 22):

영화 예매 명단 정리

Python
4 months ago
movie = ["김민수: 아바타", "이하늘: 타이타닉", "박지성: 아바타"] answer = [] for i in movie: if "아바타" in i: name = i.split(":")[0] answer.append(name) answer.sort() print(answer)

최저가 과일 구매

Python
4 months ago
prices = [1000, 800, 900, 1200, 700, 1500] min_price = prices[0] max_profit = 0 for price in prices: if price < min_price: min_price = price else: profit = price - min_price

편의점 물품 진열

Python
4 months ago
capacity = 30 items = [5, 10, 3, 8, 15, 20] items.sort() total = 0 count = 0 for weight in items: if total + weight <= capacity:

등산 페이스 분석

Python
4 months ago
heights = [100, 120, 150, 180, 160, 170, 190, 210] answer = 0 count = 0 for i in range(len(heights) - 1): if heights[i] < heights[i + 1]: count += 1 else: if count >= 3: