just do it

백준25304번/영수증/자바(java) 본문

자료구조&알고리즘/코딩테스트

백준25304번/영수증/자바(java)

밍풀 2022. 9. 1. 04:37
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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 = total+ a*b;
      }
      if(total==x) {
          System.out.println("Yes");
      }else System.out.println("No");
      
     
    }
}
 
cs

백준 채점시 유의사항 class 이름 꼭 Main 

그리고 대소문자까지 지키기...

Yes 아니고 yes로 썼더니 틀려서 뭐가 틀린건가 애먹음.....