영수증(25304)
점이 어느 사분면에 있는지 알아내는 문제
문제
입력
출력
import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int total = Integer.parseInt(br.readLine());
int cnt = Integer.parseInt(br.readLine());
int compare = 0;
for (int i = 0; i < cnt; i++) {
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
compare += (Integer.parseInt(st.nextToken()) * Integer.parseInt(st.nextToken()));
}
String str = total == compare ? "Yes" : "No";
System.out.println(str);
}
}Last updated