K

@kimjuha19

세로 읽기

Python
5 months ago
word = [ "ABCDE", "abcde", "01234", "FGHIJ", "fghij" ] answer = [] for j in range(len(word)):

도서관 대출 시스템

Python
5 months ago
class Member: def __init__(self, name): self.name = name self.limit = 3 self.borrowed = 0 def borrow_book(self): if self.borrowed >= self.limit: print("대출 불가") else:

가전 기기 통합 제어

Python
5 months ago
class Appliance: def power_on(self): pass def power_off(self): pass class TV(Appliance): def power_on(self): print("TV 전원 켬")

자율주행 택시 구간별 요금제

Python
5 months ago
class AutoTaxi: def __init__(self, car_number, location=0, mode="Normal"): self.car_number = car_number self.mode = mode self.location = location def calculate_fare(self, distance): fare = 4000 if dis

단계별 인증 및 계정 잠금 시스템

Python
5 months ago
class SecureLogin: def __init__(self, ID, password): self.ID = ID self.password = password self.fail_count = 0 self.is_locked = False def login(self, input_id, input_pw): if self.is_locked:

복리 적금 및 이자 시뮬레이션

Python
5 months ago
class SavingsAccount: def __init__(self, name, balance, annual_rate, months): self.name = name self.balance = balance self.annual_rate = annual_rate self.months = months def add_monthly_depos

회전하는 큐

Python
5 months ago
N = 10 target = [2, 9, 5] lst = list(range(1, N+1)) count = 0 for num in target: idx = lst.index(num) if idx <= len(lst)//2: count += idx

문자열 지우기

Python
5 months ago
s = "mirkovnizavlibli" t = "fili" while t in s: s = s.replace(t, "") print(s)

리플 셔플 시뮬레이션

Python
5 months ago
N = 6 Cards = [1, 2, 3, 4, 5, 6] mid = len(Cards) // 2 list1 = Cards[:mid] list2 = Cards[mid:] result = [] for i in range(mid):

스택을 이용한 수열 만들기

Python
5 months ago
N = 8 sequence = [4, 3, 6, 8, 7, 5, 2, 1] result = [] current = 1 for num in sequence: while current <= num: result.append('+') current += 1

덩치 등수 구하기

Python
5 months ago
people = [[55, 185], [58, 183], [88, 186], [60, 175], [46, 155]] ranks = [] for i in range(len(people)): rank = 1 for j in range(len(people)): if people[j][0] > people[i][0] and people[j][1] > people[i][1]: rank += 1

피보나치 수

Python
5 months ago
n = 6 if n == 0: fib_n = 0 elif n == 1: fib_n = 1 else: a, b = 0,1 for _ in range(2, n+1): a, b = b, a + b

단어 필터링

Python
5 months ago
words = ["apple", "bad", "cherry"] forbidden = "bad" answer = [] for i in range(len(words)): if words[i] != forbidden: answer.append(words[i]) print(answer)

업앤다운 게임

Python
5 months ago
target = 55 guesses = [10, 80, 40, 55, 60] count = 1 for i in range(len(guesses)): if guesses[i] != target: count += 1 else: break

중복 원소 개수

Python
5 months ago
arr = [1, 2, 2, 3, 4, 4, 4] arr.sort() count = 0 set_count = 1 for i in range(len(arr)-1): if arr[i] == arr[i+1]: set_count += 1 if set_count == 2:

지그재그 리스트

Python
5 months ago
matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] result = [] for i, row in enumerate(matrix): if i % 2 == 0:

문자열 압축 효율

Python
5 months ago
s = "aaabbb" count = 1 answer = "" for i in range(1, len(s)): if s[i] == s[i-1]: count += 1 else: answer += s[i-1] + str(count) count = 1

회원가입 비밀번호 검증 시스템

C++
5 months ago
#include <iostream> #include <string> #include <cctype> using namespace std; class User { private: string ID; string password; public:

캐릭터 경험치 및 레벨업 시스템

C++
5 months ago
#include <iostream> #include <string> using namespace std; class Character { private: string nickname; int level; int exp; public:

계좌 이체 및 한도 관리

C++
5 months ago
#include <iostream> #include <string> using namespace std; class Account { private: string owner; int balance; int limit;