관리 메뉴

피너클의 it공부방

백준 25304 영수증 (c++) : 피너클 본문

백준

백준 25304 영수증 (c++) : 피너클

피너클 2022. 8. 2. 20:59
728x90
반응형

https://www.acmicpc.net/problem/25304

 

25304번: 영수증

준원이는 저번 주에 살면서 처음으로 코스트코를 가 봤다. 정말 멋졌다. 그런데, 몇 개 담지도 않았는데 수상하게 높은 금액이 나오는 것이다! 준원이는 영수증을 보면서 정확하게 계산된 것

www.acmicpc.net

수학문제다.

#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int x, n;
	cin >> x >> n;
	for (int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		x -= a * b;
	}
	if (x == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

전체코드다.

728x90
반응형
Comments