-
Notifications
You must be signed in to change notification settings - Fork 0
/
BJ4796.py
50 lines (31 loc) · 958 Bytes
/
BJ4796.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 백준 4796번 캠핑
##이중리스트를 만들어서 입력값 받기
c_list = []
c_index = 0
while True :
a, b, c = map(int,input().split())
if(a==0 and b==0 and c==0):
break
c_list.append([])
c_list[c_index].append(a)
c_list[c_index].append(b)
c_list[c_index].append(c)
c_index += 1
##이중리스트 인덱스 순서대로 case비교
case_list = []
for i in range(len(c_list)):
case_time = 0
case_l = c_list[i][0]
case_p = c_list[i][1]
case_v = c_list[i][2]
count = case_v // case_p
case_time += count*case_l
left_time = case_v % case_p
if (left_time < case_l):
case_time += left_time
elif ( left_time >=case_l):
case_time += case_l
case_list.append(case_time)
##비교한 case리스트 요소들을 출력
for i in range(len(case_list)):
print('Case {}: {}'.format(i+1,case_list[i]))