using System;
class Program
{
static void Main(string[] args)
{
string stringTotalX = Console.ReadLine();
string stringTotalN = Console.ReadLine();
int totalX = System.Convert.ToInt32(stringTotalX);
int totalNumber = System.Convert.ToInt32(stringTotalN);
int totalWon = 0;
for (int i = 0; i < totalNumber; i++)
{
string stringProducts = Console.ReadLine();
string[] stringInput = stringProducts.Split(' ', StringSplitOptions.None);
int won = System.Convert.ToInt32(stringInput[0]);
int number = System.Convert.ToInt32(stringInput[1]);
totalWon += won * number;
}
if (totalX == totalWon)
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("No");
}
}
}
문제 출처
https://www.acmicpc.net/problem/25304
25304번: 영수증
준원이는 저번 주에 살면서 처음으로 코스트코를 가 봤다. 정말 멋졌다. 그런데, 몇 개 담지도 않았는데 수상하게 높은 금액이 나오는 것이다! 준원이는 영수증을 보면서 정확하게 계산된 것
www.acmicpc.net
'ComputerScience > Coding Test' 카테고리의 다른 글
백준 1546번: 평균 (0) | 2022.11.10 |
---|---|
백준 10807번: 개수 세기 (0) | 2022.11.10 |
백준 5597번: 과제 안 내신 분..? (0) | 2022.11.10 |
백준 3003번: 킹, 퀸, 룩, 비숍, 나이트, 폰 (0) | 2022.11.09 |
백준 브론즈 1.. 아직 멀었다. (0) | 2022.04.16 |