본문 바로가기
백준(C언어)/22년 8월

8월 17일(수) - 3단계(25304번 *추가)

by C0MPAS 2022. 8. 17.

3단계 - 25304번

 

25304번: 영수증

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

www.acmicpc.net

 

문제점

x

 

풀이

#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable: 4996)

#include <stdio.h>

int main(void)
{
	int X;
	scanf("%d", &X);

	int N, a, b;
	int total = 0;
	scanf("%d", &N);
	for (int i = 0; i < N; i++)
	{
		scanf("%d %d", &a, &b);
		total = total + a * b;
	}

	if (X == total)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
	return 0;
}

 

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

댓글