단계별로 풀어보기 > 단계 3: 반복문 > 25304번 #25304: 영수증 price = int(input()) n = int(input()) sum=0 for i in range(n): a, b = map(int,input().split()) sum=sum+a*b if price==sum: print("Yes") else: print("No") 마찬가지로 사전에 sum을 지정하면 조건문에서 price와의 비교가 수월해집니다.
[백준/Python] 25304번: 영수증
단계별로 풀어보기 > 단계 3: 반복문 > 25304번 #25304: 영수증 price = int(input()) n = int(input()) sum=0 for i in range(n): a, b = map(int,input().split()) sum=sum+a*b if price==sum: print("Yes") else: print("No") 마찬가지로 사전에 sum을 지정하면 조건문에서 price와의 비교가 수월해집니다.
2024.01.14