From b9bf6745bb1284c512053fe529e26464f26db280 Mon Sep 17 00:00:00 2001 From: gitseoyeon Date: Tue, 3 Feb 2026 19:38:08 +0900 Subject: [PATCH 1/3] =?UTF-8?q?solve:=20=EC=95=84=EC=8B=9C=EC=95=84=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EC=98=AC=EB=A6=BC=ED=94=BC=EC=95=84=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Min.java" | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Min.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Min.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Min.java" new file mode 100644 index 0000000..5d31a3d --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\225\204\354\213\234\354\225\204 \354\240\225\353\263\264\354\230\254\353\246\274\355\224\274\354\225\204\353\223\234/Min.java" @@ -0,0 +1,40 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +class Min { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + List list = new ArrayList<>(); + for(int i = 0; i < N; i++) { + StringTokenizer str = new StringTokenizer(br.readLine()); + int c = Integer.parseInt(str.nextToken()); + int stu = Integer.parseInt(str.nextToken()); + int score = Integer.parseInt(str.nextToken()); + + list.add(new int[]{c, stu, score}); + } + + list.sort((a, b) -> b[2]- a[2]); + int[] countryCnt = new int[101]; + int cnt = 0; + StringBuilder sb = new StringBuilder(); + + for(int i = 0; i < list.size(); i++) { + if(cnt == 3) break; + int[] cur = list.get(i); + int countryIdx = cur[0]; + if(countryCnt[countryIdx] < 2) { + sb.append(cur[0]).append(" ").append(cur[1]).append("\n"); + countryCnt[countryIdx] += 1; + cnt += 1; + } + } + + System.out.println(sb); + } +} \ No newline at end of file From 7f6a384978aded2c763dffb2d5da8799acfae8d0 Mon Sep 17 00:00:00 2001 From: gitseoyeon Date: Tue, 3 Feb 2026 19:38:15 +0900 Subject: [PATCH 2/3] =?UTF-8?q?solve:=20=EC=98=AC=EB=B0=94=EB=A5=B8=20?= =?UTF-8?q?=EB=B0=B0=EC=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Min.java" | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Min.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Min.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Min.java" new file mode 100644 index 0000000..28f180a --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \354\230\254\353\260\224\353\245\270 \353\260\260\354\227\264/Min.java" @@ -0,0 +1,35 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public class Min { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int N = Integer.parseInt(br.readLine()); + List list = new ArrayList<>(); + for(int i = 0; i < N; i++) { + list.add(Integer.parseInt(br.readLine())); + } + + Collections.sort(list); + int answer = 4; + for(int i = 0; i < list.size(); i++) { + int num = list.get(i); + int need = 4; + for(int j = 0; j < 4; j++) { + if(list.contains(++num)) { + need -= 1; + } + } + + answer = Math.min(answer, need); + } + + System.out.println(answer); + + + } +} From 155d8d52f0cf14ea2da7f836482dfda26c02e7ef Mon Sep 17 00:00:00 2001 From: gitseoyeon Date: Tue, 3 Feb 2026 19:38:22 +0900 Subject: [PATCH 3/3] =?UTF-8?q?solve:=20=ED=86=B1=EB=8B=88=EB=B0=94?= =?UTF-8?q?=ED=80=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Min.java" | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 "02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Min.java" diff --git "a/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Min.java" "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Min.java" new file mode 100644 index 0000000..a5f802c --- /dev/null +++ "b/02\354\233\224/1\354\243\274\354\260\250/[BOJ] \355\206\261\353\213\210\353\260\224\355\200\264/Min.java" @@ -0,0 +1,85 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class Min { + static String[][] wheels; + static int[] rotate; + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + wheels = new String[4][8]; + for(int i = 0; i < 4; i++) { + wheels[i] = br.readLine().split(""); + } + + int K = Integer.parseInt(br.readLine()); + for(int i = 0; i < K; i++) { + StringTokenizer str = new StringTokenizer(br.readLine()); + int wheel = Integer.parseInt(str.nextToken()) - 1; + int dir = Integer.parseInt(str.nextToken()); + rotate = new int[4]; + rotate[wheel] = dir; + + changeLeft(wheel, dir); + changeRight(wheel, dir); + + for(int j = 0; j < 4; j++) { + if(rotate[j] == 1) { + rotateRight(j); + } else if(rotate[j] == -1){ + rotateLeft(j); + } + } + } + int score = getScore(); + System.out.println(score); + } + + private static void rotateRight(int idx) { + String tmp = wheels[idx][7]; + for(int i = 7; i > 0; i--) { + wheels[idx][i] = wheels[idx][i - 1]; + } + wheels[idx][0] = tmp; + } + + private static void rotateLeft(int idx) { + String tmp = wheels[idx][0]; + for(int i = 0; i < 7; i++) { + wheels[idx][i] = wheels[idx][i + 1]; + } + wheels[idx][7] = tmp; + } + + private static void changeLeft(int idx, int dir) { + if(idx == 0) return; + if(!wheels[idx][6].equals(wheels[idx - 1][2])) { + rotate[idx - 1] = -dir; + changeLeft(idx - 1, -dir); + } + } + + private static void changeRight(int idx, int dir) { + if(idx == 3) return; + if(!wheels[idx][2].equals(wheels[idx + 1][6])) { + rotate[idx + 1] = -dir; + changeRight(idx + 1, -dir); + } + } + + private static int getScore() { + int sum = 0; + int plus = 1; + for(int i = 0; i < 4; i++) { + if(wheels[i][0].equals("1")) { + sum += plus; + } + plus *= 2; + } + + return sum; + } + + +}