백준 #13496번 The Merchant of Venice

jhj·2024년 2월 10일

백준 JAVA

목록 보기
210/583
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int k = sc.nextInt();
		
		for(int i = 0; i < k; i++) {
			int n = sc.nextInt();
			int s = sc.nextInt();
			int d = sc.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			int total = 0;
			for(int j = 0; j < a.length; j++) {
				a[j] = sc.nextInt();
				b[j] = sc.nextInt();
				if(s * d >= a[j]) {
					total += b[j];
				}
			}
			
			System.out.println("Data Set " + (i + 1) + ":");
			System.out.println(total);
			System.out.println();
		}
		sc.close();
	}
}
profile
개발자를 꿈꾸는

0개의 댓글