From 0ee77f9f54bc321cdc0f9910fceb51c3890e45df Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Wed, 22 Oct 2025 11:45:49 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[BOJ]=20=EB=8B=A4=EC=9D=B4=EB=82=98?= =?UTF-8?q?=EB=AF=B9=EC=9D=B4=20=EB=AD=90=EC=98=88=EC=9A=94=3F=20/=20silve?= =?UTF-8?q?r=203=20/=20120=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ohwootaek_14494.java" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "10\354\233\224/4\354\243\274\354\260\250/BOJ_14494_\353\213\244\354\235\264\353\202\230\353\257\271\354\235\264 \353\255\220\354\227\220\354\232\224/ohwootaek_14494.java" diff --git "a/10\354\233\224/4\354\243\274\354\260\250/BOJ_14494_\353\213\244\354\235\264\353\202\230\353\257\271\354\235\264 \353\255\220\354\227\220\354\232\224/ohwootaek_14494.java" "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_14494_\353\213\244\354\235\264\353\202\230\353\257\271\354\235\264 \353\255\220\354\227\220\354\232\224/ohwootaek_14494.java" new file mode 100644 index 0000000..96684dd --- /dev/null +++ "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_14494_\353\213\244\354\235\264\353\202\230\353\257\271\354\235\264 \353\255\220\354\227\220\354\232\224/ohwootaek_14494.java" @@ -0,0 +1,34 @@ +import java.io.*; +import java.util.*; + +public class Main { + static int N, M; + static long[][] D; + static final long MOD = 1_000_000_007L; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + M = Integer.parseInt(st.nextToken()); + + D = new long[N + 1][M + 1]; + for (int i = 0; i <= N; i++) Arrays.fill(D[i], -1); + + long ans = path(1, 1); + System.out.println(ans % MOD); + } + + private static long path(int x, int y) { + if (x == N && y == M) return 1; + if (x > N || y > M) return 0; + if (D[x][y] != -1) return D[x][y]; + + long res = 0; + res = (res + path(x + 1, y)) % MOD; + res = (res + path(x, y + 1)) % MOD; + res = (res + path(x + 1, y + 1)) % MOD; + + return D[x][y] = res; + } +} \ No newline at end of file From 8da0ddb69572ade9d1e89958cbb76d62a8714d6d Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Wed, 22 Oct 2025 17:39:11 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[BOJ]=20=EC=A7=95=EA=B2=80=EB=8B=A4?= =?UTF-8?q?=EB=A6=AC=20=EA=B1=B4=EB=84=88=EA=B8=B0/=20silver1/=20200?= =?UTF-8?q?=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DFS와 가지치기를 이용해 최소 에너지를 구했습니다. 세 가지 점프(작은, 큰, 매우 큰)를 모두 탐색하면서 누적 에너지를 더해가고, 마지막 돌에 도달하면 최소값(sum)을 갱신합니다. 중간에 누적 에너지가 현재 최소값보다 크면 더 이상 탐색하지 않도록 가지치기를 적용했습니다. 매우 큰 점프는 한 번만 사용할 수 있도록 cnt로 제한했습니다. ( 메모이제이션을 시도해 보았지만 구현에 실패했습니다. 이후 연습을 통해 익힌 뒤, 다음 코드부터는 적용해보겠습니다.) --- .../ohwootaek.java" | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 "10\354\233\224/4\354\243\274\354\260\250/BOJ_21317_\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260/ohwootaek.java" diff --git "a/10\354\233\224/4\354\243\274\354\260\250/BOJ_21317_\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260/ohwootaek.java" "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_21317_\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260/ohwootaek.java" new file mode 100644 index 0000000..53da859 --- /dev/null +++ "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_21317_\354\247\225\352\262\200\353\213\244\353\246\254 \352\261\264\353\204\210\352\270\260/ohwootaek.java" @@ -0,0 +1,81 @@ +package com.ssafy.pro1; + +import java.io.*; +import java.util.*; + +import com.sun.source.tree.ArrayAccessTree; + +public class pro1 { + static int N, K; + static int[][] D; + static int memo[]; + static int sum = Integer.MAX_VALUE; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + + D = new int[N-1][2]; + memo = new int[N]; + +// Arrays.fill(memo, -1); + + for(int i = 0; i < N - 1; i++) { + st = new StringTokenizer(br.readLine()); + D[i][0] = Integer.parseInt(st.nextToken()); + D[i][1] = Integer.parseInt(st.nextToken()); + } + + st = new StringTokenizer(br.readLine()); + K = Integer.parseInt(st.nextToken()); + + int ans = Dyn(0, memo, 1); + + bw.write(ans + "\n"); + + bw.flush(); + br.close(); + bw.close(); + } + + private static int Dyn(int cur, int[] memo, int cnt){ + if(cur == N - 1) {//종료조건 + sum = Math.min(sum, memo[N-1]); + return 0; + } + + if(memo[cur] != 0) { // 메모제이션 고려해봐야함 + memo[cur] = memo[cur]; + } + + if(memo[cur] > sum) return 0; //가지치기?? + + if(cur + 1 <= N - 1) { + int pl = D[cur][0]; + memo[cur + 1] = memo[cur] + pl; + Dyn(cur + 1, memo, cnt); + } + + if(cur + 2 <= N - 1) { + int us = D[cur][1]; + memo[cur + 2] = memo[cur] + us; + Dyn(cur + 2, memo, cnt); + } + + if(cur + 3 <= N - 1 && cnt > 0) { + memo[cur + 3] = memo[cur] + K; + Dyn(cur + 3, memo, cnt - 1); + } + + return sum; // 여기 부분을 수정해야됨 + } + + // 작 큰 + //0 -> 1 | 1 2 + //1 -> 2 | 2 3 + //2 -> 3 | 4 5 + //3 -> 4 | 6 7 + //매큰은 무조건 K만큼 +} \ No newline at end of file From 531ecaa6812206a1353584bdd6bfec8e00b3e135 Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:35:47 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[BOJ]=20=EB=B3=91=EC=82=AC=EB=B0=B0?= =?UTF-8?q?=EC=B9=98=ED=95=98=EA=B8=B0=20/=20silver=202=20/=20130=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 가장 긴 증가하는 부분 수열이라는 알고리즘을 사용하는 문제인 것을 발견하고 가장 긴 증가하는 부분 수열에 관련된 문제를 풀면서 공부했고 그 내용을 기반으로 문제를 해결해 나갔습니다. dp배열은 2중 반복문을 사용했고 반복문을 진행하면서 조건을 걸어서 조건에 맞는 길이만큼 DP에 저장하는 방식으로 문제를 풀었습니다 (시간은 다른 알고리즘을 공부하는 시간까지 포함시켰습니다) --- ...\354\271\230\355\225\230\352\270\260.java" | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 "10\354\233\224/4\354\243\274\354\260\250/BOJ_18353_\353\263\221\354\202\254 \353\260\260\354\271\230\355\225\230\352\270\260/ohwootaek_18353_\353\263\221\354\202\254\353\260\260\354\271\230\355\225\230\352\270\260.java" diff --git "a/10\354\233\224/4\354\243\274\354\260\250/BOJ_18353_\353\263\221\354\202\254 \353\260\260\354\271\230\355\225\230\352\270\260/ohwootaek_18353_\353\263\221\354\202\254\353\260\260\354\271\230\355\225\230\352\270\260.java" "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_18353_\353\263\221\354\202\254 \353\260\260\354\271\230\355\225\230\352\270\260/ohwootaek_18353_\353\263\221\354\202\254\353\260\260\354\271\230\355\225\230\352\270\260.java" new file mode 100644 index 0000000..14ff657 --- /dev/null +++ "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_18353_\353\263\221\354\202\254 \353\260\260\354\271\230\355\225\230\352\270\260/ohwootaek_18353_\353\263\221\354\202\254\353\260\260\354\271\230\355\225\230\352\270\260.java" @@ -0,0 +1,56 @@ +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.Arrays; +import java.util.StringTokenizer; + +public class BOJ_18353_병사배치하기 { + static int N, H; + static int[] D; + static int[] input; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + StringTokenizer st = new StringTokenizer(br.readLine()); + N = Integer.parseInt(st.nextToken()); + + D = new int[N]; + input = new int[N]; + + st = new StringTokenizer(br.readLine()); + for(int i = 0; i < N; i++) { + input[i] = Integer.parseInt(st.nextToken()); + } + + Arrays.fill(D, 1); + + int ans = 0; + for(int i = N - 2; i >= 0; i--) { + for(int j = N - 1; j > i; j--) { + if(input[i] > input[j]) { + D[i] = Math.max(D[i], D[j] + 1); + //D[i] = input[i]; + } + } + } + +// for(int i = 0; i < N; i++) { +// bw.write(D[i] + " "); +// } + + int max = Integer.MIN_VALUE; + for(int i = 0; i < N; i++) { + max = Math.max(max, D[i]); + } + + ans = N - max; + + bw.write(ans + "\n"); + + bw.flush(); + br.close(); + bw.close(); + } +} From 86c888ee91aa8dc1d7b39d7089028982ed0cba51 Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Sun, 26 Oct 2025 15:43:48 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[BOJ]=20Game=20Addiction=20/=20silver=202?= =?UTF-8?q?=20/=2060=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이전에는 주영님이 제출하신 코드를 참고하며 공부한 뒤, 그 내용을 바탕으로 문제를 풀었습니다. 주영님이 사용하신 방식(DP 접근법)을 기반으로 하니 훨씬 쉽게 해결할 수 있었습니다. 이 코드는 위와 왼쪽 방향의 값을 누적해서 더해 나가며 목표 좌표에 도달하면 탐색을 멈추고, 그 지점의 값을 최종 결과로 출력하는 방식입니다. --- .../ohwootaek_20152_gameaddiction.java" | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 "10\354\233\224/4\354\243\274\354\260\250/BOJ_20152_Game Addiction/ohwootaek_20152_gameaddiction.java" diff --git "a/10\354\233\224/4\354\243\274\354\260\250/BOJ_20152_Game Addiction/ohwootaek_20152_gameaddiction.java" "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_20152_Game Addiction/ohwootaek_20152_gameaddiction.java" new file mode 100644 index 0000000..8d0dda4 --- /dev/null +++ "b/10\354\233\224/4\354\243\274\354\260\250/BOJ_20152_Game Addiction/ohwootaek_20152_gameaddiction.java" @@ -0,0 +1,30 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class BOJ_20152_GameAddiction { + public static void main(String[] args) throws Exception{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + int N = Integer.parseInt(st.nextToken()); + int M = Integer.parseInt(st.nextToken()); + + long dp[][] = new long[N + 1][M + 1]; + + dp[1][1] = 1; + + for(int i = 1; i <= N; i++){ + for(int j = 1; j <= M; j++){ + if(i == 1 && j == 1){ + continue; + } + + dp[i][j] = (dp[i][j-1] + dp[i-1][j]+ dp[i-1][j-1]) % 1000000007; + } + } + + System.out.println(dp[N][M]%1000000007); + + br.close(); + } +} From 7bdaf1c550dc880502e320024bc5c6a3a6db2d31 Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Tue, 18 Nov 2025 01:11:15 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Create=20BOJ=5F1541=5F=EC=9E=83=EC=96=B4?= =?UTF-8?q?=EB=B2=84=EB=A6=B0=EA=B4=84=ED=98=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\354\226\264\353\262\204\353\246\260\352\264\204\355\230\270" | 1 + 1 file changed, 1 insertion(+) create mode 100644 "11\354\233\224/1\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260\352\264\204\355\230\270" diff --git "a/11\354\233\224/1\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260\352\264\204\355\230\270" "b/11\354\233\224/1\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260\352\264\204\355\230\270" new file mode 100644 index 0000000..8b13789 --- /dev/null +++ "b/11\354\233\224/1\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260\352\264\204\355\230\270" @@ -0,0 +1 @@ + From 58b2682f621c2ccd896a9efc4a14ade46bf76713 Mon Sep 17 00:00:00 2001 From: basicprogram <103624272+basicprogram@users.noreply.github.com> Date: Tue, 18 Nov 2025 16:51:44 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[BOJ]=EC=9E=83=EC=96=B4=EB=B2=84=EB=A6=B0?= =?UTF-8?q?=EA=B4=84=ED=98=B8=20/=20silver2=20/=2090=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ohwootaek" | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 "11\354\233\224/3\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270/ohwootaek" diff --git "a/11\354\233\224/3\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270/ohwootaek" "b/11\354\233\224/3\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270/ohwootaek" new file mode 100644 index 0000000..5b78937 --- /dev/null +++ "b/11\354\233\224/3\354\243\274\354\260\250/BOJ_1541_\354\236\203\354\226\264\353\262\204\353\246\260 \352\264\204\355\230\270/ohwootaek" @@ -0,0 +1,60 @@ +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +public class Main { + public static void main(String[] args) throws Exception{ + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); + + StringTokenizer st = new StringTokenizer(br.readLine()); + // 55-50+40 + String temp = st.nextToken(); + + boolean flag = temp.contains("-"); + + int sum = 0; + + if(flag){ + String number[] = temp.split("-"); + +// sum = Integer.parseInt(number[0]); + int i = 0; + + for(String num : number){ + if(i++ == 0){ + String fir[] = num.split("\\+"); + for(String s : fir){ + sum += Integer.parseInt(s); + } + continue; + } + String n[] = num.split("\\+"); + + if(num.length() < 5 && n.length == 1){ // 1자리 숫자일때만 + sum -= Integer.parseInt(num); + }else{ + String split[] = num.split("\\+"); + for(String s : split){ + sum -= Integer.parseInt(s); + } + } + } + }else{ + String split[] = temp.split("\\+"); + for(String s : split){ + sum += Integer.parseInt(s); + } + } + + bw.write(sum + "\n"); + + bw.flush(); + br.close(); + bw.close(); + } +}