Python/Greedy BOJ-10162 전자레인지

[Python/Greedy] BOJ-10162 전자레인지

📌문제링크


거스름돈 문제와 유사하게 풀면된다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
input = sys.stdin.readline

T = int(input())
189
A,B,C=0,0,0
while 1 :
    if T >= (5*60) :
        A += T//(5*60)
        T = T%(5*60)
    elif T >= (60) :
        B += T//(60)
        T = T%(60)
    elif T >= 10 :
        C += T//10
        T = T%10
    elif T==0 :
        print('{0} {1} {2}'.format(A,B,C))
        break
    else:
        print(-1)
        break