Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- 문제해결
- Java
- BFS
- oracle
- 백준
- 건강
- COS PRO
- dfs
- binary search
- 프로그래머스
- DP
- 코테
- SQL
- 이분탐색
- SWEA
- 시뮬레이션
- math
- 문제풀이
- 운동기록
- 자바
- 러닝일지
- priorityqueue
- 문자열
- 알고리즘
- 코딩테스트
- BOJ
- MySQL
- db
- 투포인터
- greedy
Archives
- Today
- Total
슈콩
[SWEA] 삼성시의 버스 노선 본문


[문제]
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWczm7QaACgDFAWn
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
[소스 코드]
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
StringBuilder sb;
int T = Integer.parseInt(br.readLine());
for(int tc=1;tc<=T;tc++) {
int n = Integer.parseInt(br.readLine());
int[] busStop = new int[5001];
sb = new StringBuilder();
for(int i=0;i<n;i++) {
st = new StringTokenizer(br.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
for(int j=a;j<=b;j++) {
busStop[j]++;
}
}
int p = Integer.parseInt(br.readLine());
for(int i=0;i<p;i++) {
int v = Integer.parseInt(br.readLine());
sb.append(busStop[v]+" ");
}
System.out.println("#"+tc+" "+sb);
}
}
}'Algorithms > SWEA' 카테고리의 다른 글
| [SWEA] 식료품 가게 (0) | 2025.11.14 |
|---|---|
| [SWEA] 5일차 - GNS (0) | 2025.11.14 |
| [SWEA] 태혁이의 사랑은 타이밍 (0) | 2025.11.14 |
| [SWEA] 다트 게임 (0) | 2025.11.14 |
| [SWEA] 숫자가 같은 배수 (0) | 2025.11.13 |