• 문제 링크
https://www.acmicpc.net/problem/10599
• 풀이 코드
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringBuilder sb = new StringBuilder();
int[] arr;
while ((arr = new int[]{read(), read(), read(), read()})[0] != 0 || arr[3] != 0)
sb.append(arr[2] - arr[1]).append(' ').append(arr[3] - arr[0]).append('\n');
bw.write(sb.toString());
bw.flush();
}
private static int read() throws IOException {
int c, n = System.in.read() & 15;
boolean flag = n == 13;
if (flag) n = System.in.read() & 15;
while ((c = System.in.read()) > 32) n = (n << 3) + (n << 1) + (c & 15);
return flag ? ~n + 1 : n;
}
}
'Problem Solving > Baekjoon' 카테고리의 다른 글
[백준] 6527 빙고라니! - Data Structure / Java (0) | 2025.05.26 |
---|---|
[백준] 11104 Fridge of Your Dreams - Implementation / Java (0) | 2025.05.25 |
[백준] 4108 지뢰찾기 - Implementation / Java (0) | 2025.05.23 |
[백준] 1308 D-Day - Implementation / Java (0) | 2025.05.22 |
[백준] 17389 보너스 점수 - Implementation / Java (0) | 2025.05.21 |
댓글