본문 바로가기

코딩 테스트/백준

[Python] 백준 25304 영수증

 

문제 분석

  • 영수증의 금액 확인
  • 각 물건의 개수와 가격
  • 구매한 물건의 총 금액

 

정답 코드

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")

'코딩 테스트 > 백준' 카테고리의 다른 글

[Python] 백준 7576 토마토  (0) 2024.12.23
[Python] 백준 1463 1로 만들기  (1) 2024.12.22
[Python] 백준 2480 주사위 세개  (2) 2024.12.19
[Python] 백준 1926 그림  (0) 2024.12.19
[Python] 백준 2798 블랙잭  (0) 2024.12.18