(풀이)
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");
}
}
}
'취업준비 - 코테 , 면접 > 알고리즘(코테) 공부' 카테고리의 다른 글
알고리즘입문(Java) - String -8.팰린드롬 (0) | 2023.02.22 |
---|---|
알고리즘입문(Java) - String -7.회문문자열 (0) | 2023.02.21 |
백준 8393번(반복문) (0) | 2023.02.20 |
백준 2739번(반복문) (0) | 2023.02.20 |
알고리즘 입문(Java) - String - 6.중복문자제거 (0) | 2023.02.19 |