• 문제 링크
https://www.acmicpc.net/problem/34692
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.PriorityQueue;
import java.util.Queue;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
Queue<Long> pq = new PriorityQueue<>();
int n = read(), m = read(), k = read();
while (m-- > 0) pq.add(0L);
while (n-- > 0) pq.add(pq.remove() + read());
bw.write(pq.remove() > k ? "GO" : "WAIT");
bw.flush();
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return n;
}
}'Problem Solving > Baekjoon' 카테고리의 다른 글
| [백준] 14670 병약한 영정 - Data Structure / Java (0) | 2025.12.26 |
|---|---|
| [백준] 30949 Equal Schedules - Data Structure / Java (0) | 2025.12.24 |
| [백준] 25757 임스와 함께하는 미니게임 - Data Structure / Java (0) | 2025.12.23 |
| [백준] 14184 IOI 2017 Logo - Data Structure / Java (0) | 2025.12.22 |
| [백준] 34635 Art Installation - Greedy / Java (0) | 2025.12.21 |
댓글