• 문제 링크
https://www.acmicpc.net/problem/15719
• 풀이 코드
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));
int n = read();
boolean[] arr = new boolean[n];
while (n-- > 0) {
int i = read();
if (arr[i]) {
bw.write(String.valueOf(i));
break;
}
arr[i] = true;
}
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' 카테고리의 다른 글
| [백준] 4592 중복을 없애자 - Implementation / Java (0) | 2025.11.01 |
|---|---|
| [백준] 4447 좋은놈 나쁜놈 - Implementation / Java (0) | 2025.10.31 |
| [백준] 14623 감정이입 - Implementation / Java (0) | 2025.10.29 |
| [백준] 15904 UCPC는 무엇의 약자일까? - Greedy / Java (0) | 2025.10.28 |
| [백준] 17224 APC는 왜 서브태스크 대회가 되었을까? - Greedy / Java (0) | 2025.10.27 |
댓글