728x90
5342번: Billing
The accounting office is having troubling with billing each department for the supplies purchased last semester. Below is a chart of all the supplies and how much they cost. You must write a program that reads a list of the supplies and computes the total
www.acmicpc.net
문제 풀이
각 물건에 해당하는 가격을 저장한 후, 입력값을 받을 때마다 물건의 가격을 더해준다. 출력은 소수점 2번째 자리까지만 출력해준다.
정답 코드
costs = {"Paper" : 57.99, "Printer" : 120.50, "Planners" : 31.25, "Binders" : 22.50, "Calendar" : 10.95, "Notebooks" : 11.20, "Ink" : 66.95}
total = 0
while True :
s = input()
if s == "EOI" : break
total += costs[s]
print("${:.2f}".format(total))
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 5666 - Hot Dogs [python] (0) | 2023.03.15 |
---|---|
[BOJ/백준] 5356 - Triangles [python] (1) | 2023.03.15 |
[BOJ/백준] 5340 - Secret Location [python] (0) | 2023.03.15 |
[BOJ/백준] 5292 - Counting Swann’s Coins [python] (1) | 2023.03.15 |
[프로그래머스] 두 큐 합 같게 만들기 [python] (0) | 2023.03.14 |