728x90
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com

import java.util.Scanner;
class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int tc = 1; tc <= t; tc++) {
int n = sc.nextInt();
int count[] = new int[5001];
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
int b = sc.nextInt();
for (int j = a; j <= b; j++) {
count[j]++;
}
}
int p = sc.nextInt();
StringBuilder sb = new StringBuilder();
System.out.print("#" + tc + " ");
for (int i = 0; i < p; i++) {
int num = sc.nextInt();
sb.append(count[num]+" ");
}
System.out.println(sb);
}
}
}728x90
'SW Expert Academy > SWEA D3' 카테고리의 다른 글
| [SW Expert Academy] 계산기 (D3) (0) | 2024.10.05 |
|---|---|
| [SW Expert Academy] 테네스의 특별한 소수 (D3) (0) | 2024.10.05 |
| [SW Expert Academy] 원재의 벽 꾸미기 (D3) (0) | 2024.10.05 |
| [SW Expert Academy] 진기의 최고급 붕어빵 (D3) (0) | 2024.10.04 |
| [SW Expert Academy] 희성이의 원근법 (D3) (0) | 2024.10.04 |