취업준비 - 코테 , 면접/알고리즘(코테) 공부
백준 25304번 (반복문)
kwohyuno
2023. 2. 20. 19:36
(풀이)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int X = sc.nextInt(); // 영수증에 적힌 총 금액
int N = sc.nextInt(); // 종류의 수
int total = 0;
for(int i = 0; i < N; i++){
int a = sc.nextInt(); // 각 물건의 가격
int b = sc.nextInt(); // 각 물건의 개수
total += a * b;
}
if(total == X){
System.out.println("Yes");
}else{
System.out.println("No");
}
}
}