(JAVA) 백준 알고리즘 No.25304

지식저장공간·2023년 2월 17일

(JAVA)PS

목록 보기
29/30

http://boj.kr/25304

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int price = Integer.parseInt(sc.nextLine());
		int loop = Integer.parseInt(sc.nextLine());
		int sum = 0;
		
		int x = 0;
		int y = 0;
		
		for(int i = 0; i<loop ; i++) {
			x = sc.nextInt();
			y = sc.nextInt();
			
			sum+= x*y;
		}
	
		if(sum == price) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

profile
발전하는 개발자가 꿈입니다. 지식을 쌓고 지식을 활용해 목표 달성을 추구합니다.

0개의 댓글