영수증
문제
입력
출력
내 풀이
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int X = Integer.parseInt(br.readLine());
int N = Integer.parseInt(br.readLine());
int a,b;
int total = 0;
for(int i = 1; i <= N; i++)
{
String str = br.readLine();
StringTokenizer st = new StringTokenizer(str);
a = Integer.parseInt(st.nextToken());
b = Integer.parseInt(st.nextToken());
total += a * b;
}
if(X == total)
System.out.println("Yes");
else
System.out.println("No");
}
}