백준: 20233번 Bicycle (Python3)
Bicycle 성공다국어
2 초 | 512 MB | 791 | 608 | 560 | 77.455% |
문제
After a long time at home during the quarantine, in November you decided to go to work by bicycle! Since you do not have your own bicycle, you have to rent one. The bike rental allows you to choose one of two monthly options:
- The monthly fee is a roubles. Every day, the first 30 minutes are free, and every minute above that costs x roubles.
- The monthly fee is b roubles. Every day, the first 45 minutes are free, and every minute above that costs y roubles.
There are 21 working days in November, and you spend T minutes commuting to work and back home in total every day. Calculate how many roubles you would spend if you use either one of two monthly options.
입력
The first four lines of the input contain integers a , x , b , and y (0≤a,x,b,y≤100 ), each on a separate line. The last line contains a single integer T (1≤T≤1440 ) --- the total time spent on a bicycle during each day.
출력
The only line of the output should contain two integers --- the amount of money you would spend on the first option and the second option, respectively.
예제 입력 1
10
1
20
5
50
예제 출력 1
430 545
예제 입력 2
10
10
10
10
42
예제 출력 2
2530 10
예제 입력 3
10
10
10
10
27
예제 출력 3
10 10
답안
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
a=int(input())
x=int(input())
b=int(input())
y=int(input())
T=int(input())
working_days=21
if (T-30)<0:
print(a, end = " ")
else:
print(a + working_days*(T-30) * x, end = " ")
if (T-45)<0:
print(b, end= " ")
else:
print(b + working_days * (T-45) * y)
|
cs |

'공부 > 코딩테스트' 카테고리의 다른 글
백준: 17388번 와글와글 숭고한 (Python3) (0) | 2022.08.10 |
---|---|
백준: 17863번 FYI (Python3) (0) | 2022.08.10 |
백준: 20352번 Circus (Python3) (0) | 2022.08.10 |
백준: 20353번 Atrium (Python3) (0) | 2022.08.10 |
백준: 20499번 Darius님 한타 안 함?(Python3) (0) | 2022.08.10 |
댓글