๐Ÿ•ธ Algorithm/๐Ÿ•ธ ๋ฐฑ์ค€ BaekJoon

[๋ฐฑ์ค€][java][25304][์˜์ˆ˜์ฆ]

๋‰ด์ด NUEY 2023. 10. 3. 19:23
๋ฐ˜์‘ํ˜•

import java.util.Scanner;

// 25304	์˜์ˆ˜์ฆ
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int sum = sc.nextInt();
		int num = sc.nextInt();
		int itemPrice = 0;
		
		for (int i=0; i < num; i++) {
			int price = sc.nextInt();
			int item = sc.nextInt();
			
			itemPrice += price*item;
		}
		sc.close();
		
		System.out.print(sum == itemPrice ? "Yes" : "No");
	}
}

 

๋ฐ˜์‘ํ˜•