- 거스름돈
n = 1260
count = 0
money_list = [500, 100, 50, 10]
for money in money_list:
count += (n // money)
n %= money
print(count)
- 큰 수의 법칙
'''list 입력받아서 sort() => 큰 수, 작은 수 저장 후 문제 조건에 맞춰 연산값 반환하도록 함.'''
N, M, K = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()
one = num_list[-1]
two = num_list[-2]
one_count = (M // K) * K
two_count = M % K
count = 0
for i in range(one_count):
count += one
for i in range(two_count):
count += two
print(count)
- 숫자 카드 게임
'''가장 숫자가 낮은 카드 선택 ==> min() 활용
list에 반복문 돌며 추가하여 그 중에 max인 값의 index+1 반환'''
N, M = map(int, input().split())
min_list = []
for i in range(N):
num_list = list(map(int, input().split()))
min_data = min(num_list)
min_list.append(min_data)
print(max(min_list))
- 1이 될 때까지
'''while문으로 N >= 1일때까지만 수행하는 조건 세우고 아래 조건에 따라 코딩'''
N, K = map(int, input().split())
count = 0
while(N > 1):
if (N % K != 0):
N -= 1
count += 1
else:
N = N // K
count += 1
print(count)