K

@kimjuha19

가전 기기 에너지 모니터

Python
4 months ago
class Device: def __init__(self, name, power_watt): self.name = name self.power_watt = power_watt self.hours = 0 def set_hours(self, hours): self.hours = hours def energy_kwh(self):

분해합

Python
4 months ago
N = 216 constructor = 0 for i in range(1, N): digit_sum = sum(int(d) for d in str(i)) if i + digit_sum == N: constructor = i break

최대공약수와 최소공배수

Python
4 months ago
A = 24 B = 18 a, b = A, B while b != 0: a, b = b, a % b gcd_value = a lcm_value = (A * B) // gcd_value

문자열 집합

Python
4 months ago
S = ["baekjoononlinejudge", "startlink", "codeplus"] check_words = ["baekjoon", "codeplus"] S_set = set(S) count = sum(1 for word in check_words if word in S_set) print(count)

1, 2, 3 더하기

Python
4 months ago
N = 4 dp = [0] * (N + 1) if N >= 1: dp[1] = 1 if N >= 2: dp[2] = 2 if N >= 3: dp[3] = 4 for i in range(4, N + 1): dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]

통계학

Python
4 months ago
from collections import Counter nums = [1, 3, 8, -2, 2] N = len(nums) nums.sort() avg = round(sum(nums) / N) mid = nums[N // 2]

로프

Python
4 months ago
ropes = [10, 15] ropes.sort(reverse=True) max_weight = 0 for i in range(len(ropes)): max_weight = max(max_weight, ropes[i] * (i + 1)) print(max_weight)

카드 2

Python
4 months ago
from collections import deque N = 6 cards = deque(range(1, N + 1)) while len(cards) > 1: cards.popleft() cards.append(cards.popleft())

단어 공부

Python
4 months ago
word = input().strip().upper() count = {} for i in word: if i in count: count[i] += 1 else: count[i] = 1

소수 구하기

Python
4 months ago
M = 3 N = 16 answer = [] for num in range(M, N): if num < 2: continue is_prime = True for i in range(2, int(num ** 0.5) + 1): if num % i == 0:

수 찾기

Python
4 months ago
num = [4, 1, 5, 2, 3] find = [1, 3, 7] answer = [0 for _ in range(len(find))] for j in range(len(answer)): for i in range(len(num)): if num[i] == find[j]: answer[j] += 1 print(answer)

동전

Python
4 months ago
coins = [1, 5, 10, 50, 100] K = 470 coins.sort(reverse=True) count = 0 for coin in coins: if K == 0: break num = K // coin count += num

설탕 배달

Python
4 months ago
N = 18 F = 5 T = 3 bags = 0 while N >= 0: if N % F == 0: bags += N // F break N -= T

제로

Python
4 months ago
number = [3, 0, 4, 0] answer = 0 for i in range(len(number)): if number[i] == 0: answer = 0 else: answer += number[i] print(answer)

평행하는 선분의 수

Python
4 months ago
n = int(input()) coordinate = [] count = 0 for i in range(n): coordinate.append(list(map(int, input().split()))) for i in range(n): for j in range(i + 1, n): if coordinate[i][0] == coordinate[j][0]:

무인 주문 및 거스름돈 시스템

Python
5 months ago
class Menu: def __init__(self, name, price): self.name = name self.price = price class Kiosk: def __init__(self, menus): self.menus = menus self.cart = []

차종별 구역 및 요금 차등화

Python
5 months ago
class Car: def __init__(self, name, fuel, time): self.name = name self.fuel = fuel self.time = time class ParkingLot: def __init__(self): self.electric_zone = ["B-1", "B-2"] self.compact_zone = ["C-1"

재고 연동 및 운송장 발급 시뮬레이션

Python
5 months ago
import random class Warehouse: def __init__(self): self.stock = {"마우스": 2} def check_stock(self, item, quantity): if item in self.stock and self.stock[item] >= quantity: self.stock[item] -= quantity

로또

Python
5 months ago
import random count = 0 my_nums = [33, 42, 40, 12, 34, 4] lotto_numbers = random.sample(range(1, 46), 6) for i in range(6): if my_nums[i] == lotto_numbers[i]: count += 1

파티 사냥 및 역할별 스킬 구현

Python
5 months ago
class Hero: def __init__(self, monster_hp, hp, damege, area,mana): self.monster_hp = monster_hp self.hp = hp self.damege = damege self.area = area self.mana = mana def warrior(self): self.mon