본문 바로가기
python-algorithm

백준 25881 Electric Bill

by 무적김두칠 2022. 11. 29.

https://www.acmicpc.net/problem/25881

 

25881번: Electric Bill

The first input line contains two integers (each between 2 and 20, inclusive), indicating the rate/KWH for the first 1000 KWH and the rate/KWH for the additional usage, respectively. The next input line contains a positive integer, n, indicating the number

www.acmicpc.net

 

1
2
3
4
5
6
7
if __name__ == '__main__':
    first_price, second_price = map(int, (input().split()))
    n = int(input())
    for _ in range(n):
        kwh = int(input())
        total = min(1000, kwh)*first_price + max(kwh-1000,0)*second_price
        print(kwh, total)
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 13623 Zero or One  (0) 2022.11.30
백준 25600 Triathlon  (0) 2022.11.29
백준 25983 Majestic 10  (0) 2022.11.29
백준 25858 Divide the Cash  (0) 2022.11.29
백준 25991 Lots of Liquid  (0) 2022.11.29

댓글