코딩 테스트/백준
[Python] 백준 25304 영수증
위시리
2024. 12. 22. 13:16
문제 분석
- 영수증의 금액 확인
- 각 물건의 개수와 가격
- 구매한 물건의 총 금액
정답 코드
import sys
input = sys.stdin.readline
x = int(input())
n = int(input())
price = 0
for _ in range(n):
a, b = map(int, input().split())
price += a*b
if price == x :
print("Yes")
else :
print("No")