From 3a796575738def4f8aeebf88bae0ee413e112b9e Mon Sep 17 00:00:00 2001 From: chanhyeok oh <125783546+ochanhyeok@users.noreply.github.com> Date: Sun, 8 Mar 2026 21:12:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20[=EC=98=A4=EC=B0=AC=ED=98=81][26030?= =?UTF-8?q?9]=20=EC=9C=A0=EC=A0=80=EA=B0=80=20=EC=9E=91=EC=84=B1=ED=95=9C?= =?UTF-8?q?=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EA=B8=B8=EC=9D=B4=EC=9D=98=20?= =?UTF-8?q?=ED=95=A9=20=EC=A0=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...200 \352\270\270\354\235\264\354\235\230 \355\225\251.sql" | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 "\354\230\244\354\260\254\355\230\201/week16/\354\234\240\354\240\200\352\260\200 \354\236\221\354\204\261\355\225\234 \352\262\214\354\213\234\352\270\200 \352\270\270\354\235\264\354\235\230 \355\225\251.sql" diff --git "a/\354\230\244\354\260\254\355\230\201/week16/\354\234\240\354\240\200\352\260\200 \354\236\221\354\204\261\355\225\234 \352\262\214\354\213\234\352\270\200 \352\270\270\354\235\264\354\235\230 \355\225\251.sql" "b/\354\230\244\354\260\254\355\230\201/week16/\354\234\240\354\240\200\352\260\200 \354\236\221\354\204\261\355\225\234 \352\262\214\354\213\234\352\270\200 \352\270\270\354\235\264\354\235\230 \355\225\251.sql" new file mode 100644 index 0000000..bec63ca --- /dev/null +++ "b/\354\230\244\354\260\254\355\230\201/week16/\354\234\240\354\240\200\352\260\200 \354\236\221\354\204\261\355\225\234 \352\262\214\354\213\234\352\270\200 \352\270\270\354\235\264\354\235\230 \355\225\251.sql" @@ -0,0 +1,4 @@ +select user_id, sum(length(contents)) as total +from blog_posts +group by user_id +order by total desc, user_id desc; \ No newline at end of file From 12611b0a617393bef408c5c885c871361d9265c7 Mon Sep 17 00:00:00 2001 From: chanhyeok oh <125783546+ochanhyeok@users.noreply.github.com> Date: Thu, 12 Mar 2026 00:30:13 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20[=EC=98=A4=EC=B0=AC=ED=98=81][26031?= =?UTF-8?q?2]=20=EC=88=AB=EC=9E=90=20=EC=95=BC=EA=B5=AC=20=EC=A0=9C?= =?UTF-8?q?=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...354\236\220 \354\225\274\352\265\254.java" | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 "\354\230\244\354\260\254\355\230\201/week16/\354\210\253\354\236\220 \354\225\274\352\265\254.java" diff --git "a/\354\230\244\354\260\254\355\230\201/week16/\354\210\253\354\236\220 \354\225\274\352\265\254.java" "b/\354\230\244\354\260\254\355\230\201/week16/\354\210\253\354\236\220 \354\225\274\352\265\254.java" new file mode 100644 index 0000000..a86deca --- /dev/null +++ "b/\354\230\244\354\260\254\355\230\201/week16/\354\210\253\354\236\220 \354\225\274\352\265\254.java" @@ -0,0 +1,82 @@ +package com.codingtest; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class 숫자야구 { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st; + + int N = Integer.parseInt(br.readLine()); + + int[] nums = new int[N]; + int[] strikes = new int[N]; + int[] balls = new int[N]; + + for (int i = 0; i < N; i++) { + st = new StringTokenizer(br.readLine()); + + nums[i] = Integer.parseInt(st.nextToken()); + strikes[i] = Integer.parseInt(st.nextToken()); + balls[i] = Integer.parseInt(st.nextToken()); + } + + int cnt = 0; + + for (int p = 123; p <= 987; p++) { + int a = p / 100; + int b = p / 10 % 10; + int c = p % 10; + + if (a == 0 || b == 0 || c == 0) { + continue; + } + if (a == b || b == c || c == a) { + continue; + } + + boolean valid = true; + for (int i = 0; i < N; i++) { + int qa = nums[i] / 100; + int qb = nums[i] / 10 % 10; + int qc = nums[i] % 10; + + int strike = 0, ball = 0; + if (a == qa) { + strike++; + } + if (b == qb) { + strike++; + } + if (c == qc) { + strike++; + } + + if (a == qb || a == qc) { + ball++; + } + if (b == qa || b == qc) { + ball++; + } + if (c == qa || c == qb) { + ball++; + } + + if (strike != strikes[i] || ball != balls[i]) { + valid = false; + break; + } + + } + + if (valid) { + cnt++; + } + } + + System.out.println(cnt); + } +} From 4c36816f6856b748b4163621c65a921a9cbb7758 Mon Sep 17 00:00:00 2001 From: chanhyeok oh <125783546+ochanhyeok@users.noreply.github.com> Date: Thu, 12 Mar 2026 08:34:33 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20[=EC=98=A4=EC=B0=AC=ED=98=81][26031?= =?UTF-8?q?2]=20=EC=96=91=EA=B6=81=EB=8C=80=ED=9A=8C=20=EC=A0=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\352\266\201\353\214\200\355\232\214.java" | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 "\354\230\244\354\260\254\355\230\201/week16/\354\226\221\352\266\201\353\214\200\355\232\214.java" diff --git "a/\354\230\244\354\260\254\355\230\201/week16/\354\226\221\352\266\201\353\214\200\355\232\214.java" "b/\354\230\244\354\260\254\355\230\201/week16/\354\226\221\352\266\201\353\214\200\355\232\214.java" new file mode 100644 index 0000000..0aeafc9 --- /dev/null +++ "b/\354\230\244\354\260\254\355\230\201/week16/\354\226\221\352\266\201\353\214\200\355\232\214.java" @@ -0,0 +1,63 @@ +class Solution { + + static int maxDiff; + static int[] answer; + + public int[] solution(int n, int[] info) { + maxDiff = 0; + answer = null; + dfs(0, n, info, new int[11]); + + return answer == null ? new int[]{-1} : answer; + } + + static void dfs(int idx, int remain, int[] info, int[] lion){ + if(idx == 11){ + lion[10] += remain; + + int diff = calcDiff(info, lion); + if(diff > maxDiff){ + maxDiff = diff; + answer = lion.clone(); + } else if(diff == maxDiff && diff > 0){ + if(isBetter(lion, answer)){ + answer = lion.clone(); + } + } + + lion[10] -= remain; + + return; + } + + if(remain > info[idx]){ + lion[idx] = info[idx] + 1; + dfs(idx + 1, remain - lion[idx], info, lion); + lion[idx] = 0; + } + + dfs(idx + 1, remain, info, lion); + } + + static int calcDiff(int[] info, int[] lion){ + int lionSco = 0, apSco = 0; + for(int i = 0; i <= 10; i++){ + int sco = 10 - i; + if(lion[i] > info[i]){ + lionSco += sco; + } else if(info[i] > 0){ + apSco += sco; + } + } + return lionSco - apSco; + } + + static boolean isBetter(int[] lion, int[] answer){ + for(int i = 10; i >= 0; i--){ + if(lion[i] != answer[i]){ + return lion[i] > answer[i]; + } + } + return false; + } +} \ No newline at end of file