코테 대비 python/백준
25304 합,곱
ylab
2023. 1. 30. 19:18
https://www.acmicpc.net/problem/25304
25304번: 영수증
준원이는 저번 주에 살면서 처음으로 코스트코를 가 봤다. 정말 멋졌다. 그런데, 몇 개 담지도 않았는데 수상하게 높은 금액이 나오는 것이다! 준원이는 영수증을 보면서 정확하게 계산된 것
www.acmicpc.net
#총금액 x
#구매한 물건의 종류의 수 n
#각 물건의 가격 a와 개수 b 가 공백을 사이에 두고 주어짐
total = int(input())
n= int(input())
def multiple(a,b):
c=a*b
return c
def check(t,d):
if t==d:
return print("Yes")
else:
return print("No")
result =0
for _ in range(n):
A,B = map(int,input().split())
result+=multiple(A,B)
#result+=A*B
check(total,result)
출력에 YES라고 해서 엄청 오래걸렸다..
꼼꼼하게 살피자