From 3dc20dfa985477e304e55a817d45d6e372ed68fb Mon Sep 17 00:00:00 2001 From: oncsr Date: Mon, 15 Sep 2025 23:50:21 +0900 Subject: [PATCH] =?UTF-8?q?[20250915]=20BOJ=20/=20G3=20/=20=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=ED=94=84=20=EB=A6=AC=EB=B7=B0=20=EC=9C=A0=ED=8A=9C?= =?UTF-8?q?=EB=B2=84=20/=20=EA=B6=8C=ED=98=81=EC=A4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 \354\234\240\355\212\234\353\262\204.md" | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 "khj20006/202509/15 BOJ G3 \352\267\270\353\236\230\355\224\204 \353\246\254\353\267\260 \354\234\240\355\212\234\353\262\204.md" diff --git "a/khj20006/202509/15 BOJ G3 \352\267\270\353\236\230\355\224\204 \353\246\254\353\267\260 \354\234\240\355\212\234\353\262\204.md" "b/khj20006/202509/15 BOJ G3 \352\267\270\353\236\230\355\224\204 \353\246\254\353\267\260 \354\234\240\355\212\234\353\262\204.md" new file mode 100644 index 00000000..726e4d5e --- /dev/null +++ "b/khj20006/202509/15 BOJ G3 \352\267\270\353\236\230\355\224\204 \353\246\254\353\267\260 \354\234\240\355\212\234\353\262\204.md" @@ -0,0 +1,109 @@ +```java +import java.io.*; +import java.util.*; + +class IOController { + BufferedReader br; + BufferedWriter bw; + StringTokenizer st; + + public IOController() { + br = new BufferedReader(new InputStreamReader(System.in)); + bw = new BufferedWriter(new OutputStreamWriter(System.out)); + st = new StringTokenizer(""); + } + + String nextLine() throws Exception { + String line = br.readLine(); + st = new StringTokenizer(line); + return line; + } + + String nextToken() throws Exception { + while (!st.hasMoreTokens()) + nextLine(); + return st.nextToken(); + } + + int nextInt() throws Exception { + return Integer.parseInt(nextToken()); + } + + long nextLong() throws Exception { + return Long.parseLong(nextToken()); + } + + double nextDouble() throws Exception { + return Double.parseDouble(nextToken()); + } + + void close() throws Exception { + bw.flush(); + bw.close(); + } + + void write(String content) throws Exception { + bw.write(content); + } + +} + +public class Main { + + static IOController io; + + // + + static int N; + static int[] c; + static List[] graph; + + public static void main(String[] args) throws Exception { + + io = new IOController(); + + N = io.nextInt(); + c = new int[N+1]; + graph = new List[N+1]; + for(int i=1;i<=N;i++) graph[i] = new ArrayList<>(); + + for(int i=1;i= 3) { + int a = graph[i].get(0); + int b = graph[i].get(1); + int c = graph[i].get(2); + io.write("3\n"); + io.write(a + " " + b + "\n"); + io.write(b + " " + c + "\n"); + io.write(a + " " + c + "\n"); + io.close(); + return; + } + + for(int i=1;i<=N;i++) for(int j:graph[i]) { + if(c[i] == 2 && c[j] == 2) { + int a = graph[i].get(0); + if(a == j) a = graph[i].get(1); + int b = graph[j].get(0); + if(b == i) b = graph[j].get(1); + io.write("3\n"); + io.write(a + " " + b + "\n"); + io.write(a + " " + j + "\n"); + io.write(b + " " + i + "\n"); + io.close(); + return; + } + } + + } + +} +```