From e889281213b0c2626a3e23cddc3c1843f2b35b0d Mon Sep 17 00:00:00 2001 From: Yang-Chaeyeon <51074379+Yang-Chaeyeon@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:27:33 +0900 Subject: [PATCH 01/20] =?UTF-8?q?Docs:=20Readme=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5d0099..9d3a503 100644 --- a/README.md +++ b/README.md @@ -151,4 +151,5 @@ git commit -m "[PGS] 이종혁 / Hello World / 브론즈5 / 10 " | Week6 | 25.08.20 | Mathematics(수학)


Backtracking(백트래킹) | [더하기 사이클](https://www.acmicpc.net/problem/1110)
[에라토스테네스의 체](https://www.acmicpc.net/problem/2960)

[N과 M(1)](https://www.acmicpc.net/problem/15649)
[부분 수열의 합](https://www.acmicpc.net/problem/1182)
[스도쿠](https://www.acmicpc.net/problem/2580)
|





| 조원희 | | Week7 | 25.08.27 | Greedy1(그리디) | [거스름돈](https://www.acmicpc.net/problem/14916)
[문서 검색](https://www.acmicpc.net/problem/1543)
[체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)
[카약과 강풍](https://www.acmicpc.net/problem/2891)
[등수 매기기](https://www.acmicpc.net/problem/2012)
|

Lv.1


| 조원희 | | Week8 | 25.09.03 | Greedy2(그리디) | 지붕잃고 외양간 고치기
[강의실 배정](https://www.acmicpc.net/problem/11000)
[섬 연결하기](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | ?

Lv.3 | 조원희 | -| Week9 | 25.09.10 | Dynamic Programming(동적 계획법) | [다리 놓기](https://www.acmicpc.net/problem/1010)
[1로 만들기](https://www.acmicpc.net/problem/1463)|
| 조원희 | +| Week9 | 25.09.10 | Dynamic Programming1(동적 계획법) | [다리 놓기](https://www.acmicpc.net/problem/1010)
[1로 만들기](https://www.acmicpc.net/problem/1463)|
| 조원희 | +| Week10 | 25.09.17 | Dynamic Programming2(동적 계획법) | [가장 긴 증가하는 부분 수열](https://www.acmicpc.net/problem/11053)
[가장 긴 바이토닉 부분 수열](https://www.acmicpc.net/problem/11054)|
| 조원희 | From 4ffde9b38a215ef7eba835fd1f7ac194288bc1a9 Mon Sep 17 00:00:00 2001 From: Yang-Chaeyeon <51074379+Yang-Chaeyeon@users.noreply.github.com> Date: Sun, 14 Sep 2025 16:00:58 +0900 Subject: [PATCH 02/20] =?UTF-8?q?Docs:=20Readme=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9d3a503..0f99cde 100644 --- a/README.md +++ b/README.md @@ -152,4 +152,4 @@ git commit -m "[PGS] 이종혁 / Hello World / 브론즈5 / 10 " | Week7 | 25.08.27 | Greedy1(그리디) | [거스름돈](https://www.acmicpc.net/problem/14916)
[문서 검색](https://www.acmicpc.net/problem/1543)
[체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)
[카약과 강풍](https://www.acmicpc.net/problem/2891)
[등수 매기기](https://www.acmicpc.net/problem/2012)
|

Lv.1


| 조원희 | | Week8 | 25.09.03 | Greedy2(그리디) | 지붕잃고 외양간 고치기
[강의실 배정](https://www.acmicpc.net/problem/11000)
[섬 연결하기](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | ?

Lv.3 | 조원희 | | Week9 | 25.09.10 | Dynamic Programming1(동적 계획법) | [다리 놓기](https://www.acmicpc.net/problem/1010)
[1로 만들기](https://www.acmicpc.net/problem/1463)|
| 조원희 | -| Week10 | 25.09.17 | Dynamic Programming2(동적 계획법) | [가장 긴 증가하는 부분 수열](https://www.acmicpc.net/problem/11053)
[가장 긴 바이토닉 부분 수열](https://www.acmicpc.net/problem/11054)|
| 조원희 | +| Week10 | 25.09.17 | Dynamic Programming2(동적 계획법) | [가장 긴 증가하는 부분 수열](https://www.acmicpc.net/problem/11053)
[가장 긴 바이토닉 부분 수열](https://www.acmicpc.net/problem/11054)
[정수 삼각형](https://school.programmers.co.kr/learn/courses/30/lessons/43105)
[0/1 Knapsack](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWBJAVpqrzQDFAWr&)|

Lv.3
D3 | 조원희 | From afc430e4bef48d3fd0477277d34b94628e5c602a Mon Sep 17 00:00:00 2001 From: woni-jo Date: Wed, 10 Sep 2025 12:29:38 +0900 Subject: [PATCH 03/20] =?UTF-8?q?[BOJ]=20=EC=A1=B0=EC=9B=90=ED=9D=AC=20/?= =?UTF-8?q?=20=EB=8B=A4=EB=A6=AC=20=EB=86=93=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=845=20/=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1010_\354\213\244\353\262\2045.java" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" diff --git "a/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" "b/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" new file mode 100644 index 0000000..9d452a7 --- /dev/null +++ "b/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" @@ -0,0 +1,37 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.util.StringTokenizer; + +public class Main { + private static int[][] dp; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int T = Integer.parseInt(br.readLine()); + + StringTokenizer st; + StringBuilder sb = new StringBuilder(); + for(int i=0;i 0) { + return dp[n][r]; + } else if(n == r || r == 0) { + return dp[n][r] = 1; + } else { + return dp[n][r] = combination(n - 1, r - 1) + combination(n - 1, r); + } + } +} \ No newline at end of file From 59b24719681650140c119b05db4ec7c55f18389b Mon Sep 17 00:00:00 2001 From: woni-jo Date: Wed, 10 Sep 2025 12:29:50 +0900 Subject: [PATCH 04/20] =?UTF-8?q?[BOJ]=20=EC=A1=B0=EC=9B=90=ED=9D=AC=20/?= =?UTF-8?q?=201=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=843=20/=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1463_\354\213\244\353\262\2043.java" | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 "Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" diff --git "a/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" "b/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" new file mode 100644 index 0000000..221286e --- /dev/null +++ "b/Java/\354\241\260\354\233\220\355\235\254/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" @@ -0,0 +1,36 @@ +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.Arrays; + +public class Main { + private static int[] dp; + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int N = Integer.parseInt(br.readLine()); + dp = new int[N + 1]; + Arrays.fill(dp, Integer.MAX_VALUE); + + DP(N, 0); + + System.out.println(dp[1]); + br.close(); + } + + private static void DP (int n, int count) { + if(dp[n] < count) { + return; + } + dp[n] = count; + if(n % 3 == 0){ + DP(n / 3, count + 1); + } + if(n % 2 == 0){ + DP(n / 2, count + 1); + } + if(n > 1) { + DP(n - 1, count + 1); + } + } +} \ No newline at end of file From 695ef2d70f7662ba38d71c3bd1799927182195e9 Mon Sep 17 00:00:00 2001 From: wjddydwns Date: Wed, 27 Aug 2025 23:15:42 +0900 Subject: [PATCH 05/20] =?UTF-8?q?=EC=8B=A4=EC=88=98=EB=A1=9C=20=EB=A8=B8?= =?UTF-8?q?=EC=A7=80=20=ED=96=88=EC=96=B4=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4_M(1)_15649_\354\213\244\353\262\2043.py" | 18 --------------- ..._\353\270\214\353\241\240\354\246\2101.py" | 23 ------------------- ...225\251_1182_\354\213\244\353\262\2043.py" | 21 ----------------- ...262\264_2960_\354\213\244\353\262\2044.py" | 23 ------------------- .../[week 6]/input.txt" | 1 - .../[week 6]/input2.txt" | 1 - .../[week 6]/input3.txt" | 1 - .../[week 6]/input4.txt" | 2 -- 8 files changed, 90 deletions(-) delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" delete mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" deleted file mode 100644 index 80d35cb..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" +++ /dev/null @@ -1,18 +0,0 @@ -import sys -from itertools import permutations -sys.stdin = open('input3.txt', 'r') - -n, m = map(int, input().split()) -arr = list(range(1,n+1)) -# 순열 딸-각 -perm = list(permutations(arr,m)) - -# 4개짜리 5개짤리 이렇게하면 너무 많아서 언패킹이 안됨 -# for a, b in perm: -# print(a, b) - -for p in perm: - print(*p) # *p로 튜플 언패킹 - - -# diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" deleted file mode 100644 index f2a6497..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" +++ /dev/null @@ -1,23 +0,0 @@ -import sys - -sys.stdin = open('input.txt', 'r') - -n = int(input()) -# 만약 n 값이 10보다 작다면 앞에 0을 붙여 두자리 수로 만들고 각 자리의 숫자를 더한다. -# 주어진 수 의 가장 오른쪽 자리 수와 앞에서 구한 합의 가장 오른쪽 자리 수를 이어 붙여 새로운 수를 만들ㄹ어보자. -count = 0 -# 0보다 작은거 어떻게 처리하지 -# -> 0보다 작은거 왜 되는지 모르겠음 -num = n -# 무한 뻉뻉이 -while(True): - a = num // 10 - b = num % 10 - new_num = b * 10 + (a + b) % 10 - count += 1 - num = new_num - if(num == n): - break - - -print(count) diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" deleted file mode 100644 index 1f108f6..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" +++ /dev/null @@ -1,21 +0,0 @@ -import sys -from itertools import combinations -sys.stdin = open('input4.txt', 'r') - -n, s = map(int, input().split()) -arr = list(map(int, input().split())) - -count = 0 - -for i in range(1, len(arr)+1): - for j in list(combinations(arr, i)): - if sum(j) == s: - count += 1 - -print(count) - - - - - - diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" deleted file mode 100644 index 55d0314..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" +++ /dev/null @@ -1,23 +0,0 @@ -import sys - -sys.stdin = open('input2.txt', 'r') - -n, k = map(int, input().split()) - -# 소수 판별 함수 너무 기얼서 개빡침 암기 ㄱㄱ -소수판별 = lambda n: n > 1 and all(n % i != 0 for i in range(2, int(n**0.5) + 1)) - -arr = list(range(2, n+1)) # [2,3,...,n] -count = 0 - -for i in range(2, n+1): - if 소수판별(i): # 남아 있는 i가 소수면 i = 2,3,4, .. 7 - # i의 배수 제거 - for j in arr: - if j % i == 0: # 2 % 2 == 0 , 4 % 2 == 0 - arr.remove(j) # [2,3,4,5,6,7] => [3,4,5,6,7] / [3,4,5,6,7] => [3,5,6,7] ... - count += 1 - if count == k: - print(j) - - diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" deleted file mode 100644 index 56a6051..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" deleted file mode 100644 index 2b8d213..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" +++ /dev/null @@ -1 +0,0 @@ -7 3 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" deleted file mode 100644 index af1e489..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" +++ /dev/null @@ -1 +0,0 @@ -4 2 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" deleted file mode 100644 index 1f5df2c..0000000 --- "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" +++ /dev/null @@ -1,2 +0,0 @@ -5 0 --7 -3 -2 5 8 \ No newline at end of file From 2c5d921fb16fa3ec65a10d96e9fee095a9515923 Mon Sep 17 00:00:00 2001 From: wjddydwns Date: Wed, 27 Aug 2025 23:16:19 +0900 Subject: [PATCH 06/20] =?UTF-8?q?=EC=8B=A4=EC=88=98=EB=A1=9C=20=EB=A8=B8?= =?UTF-8?q?=EC=A7=80=20=ED=96=88=EC=96=B4=EC=9A=94..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4_M(1)_15649_\354\213\244\353\262\2043.py" | 18 +++++++++++++++ ..._\353\270\214\353\241\240\354\246\2101.py" | 23 +++++++++++++++++++ ...225\251_1182_\354\213\244\353\262\2043.py" | 21 +++++++++++++++++ ...262\264_2960_\354\213\244\353\262\2044.py" | 23 +++++++++++++++++++ .../[week 6]/input.txt" | 1 + .../[week 6]/input2.txt" | 1 + .../[week 6]/input3.txt" | 1 + .../[week 6]/input4.txt" | 2 ++ 8 files changed, 90 insertions(+) create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" new file mode 100644 index 0000000..80d35cb --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]N\352\263\274_M(1)_15649_\354\213\244\353\262\2043.py" @@ -0,0 +1,18 @@ +import sys +from itertools import permutations +sys.stdin = open('input3.txt', 'r') + +n, m = map(int, input().split()) +arr = list(range(1,n+1)) +# 순열 딸-각 +perm = list(permutations(arr,m)) + +# 4개짜리 5개짤리 이렇게하면 너무 많아서 언패킹이 안됨 +# for a, b in perm: +# print(a, b) + +for p in perm: + print(*p) # *p로 튜플 언패킹 + + +# diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" new file mode 100644 index 0000000..f2a6497 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\215\224\355\225\230\352\270\260_\354\202\254\354\235\264\355\201\264_1110_\353\270\214\353\241\240\354\246\2101.py" @@ -0,0 +1,23 @@ +import sys + +sys.stdin = open('input.txt', 'r') + +n = int(input()) +# 만약 n 값이 10보다 작다면 앞에 0을 붙여 두자리 수로 만들고 각 자리의 숫자를 더한다. +# 주어진 수 의 가장 오른쪽 자리 수와 앞에서 구한 합의 가장 오른쪽 자리 수를 이어 붙여 새로운 수를 만들ㄹ어보자. +count = 0 +# 0보다 작은거 어떻게 처리하지 +# -> 0보다 작은거 왜 되는지 모르겠음 +num = n +# 무한 뻉뻉이 +while(True): + a = num // 10 + b = num % 10 + new_num = b * 10 + (a + b) % 10 + count += 1 + num = new_num + if(num == n): + break + + +print(count) diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" new file mode 100644 index 0000000..1f108f6 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\353\266\200\353\266\200\354\210\234\354\227\264\354\235\230_\355\225\251_1182_\354\213\244\353\262\2043.py" @@ -0,0 +1,21 @@ +import sys +from itertools import combinations +sys.stdin = open('input4.txt', 'r') + +n, s = map(int, input().split()) +arr = list(map(int, input().split())) + +count = 0 + +for i in range(1, len(arr)+1): + for j in list(combinations(arr, i)): + if sum(j) == s: + count += 1 + +print(count) + + + + + + diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" new file mode 100644 index 0000000..55d0314 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/[BOJ]\354\227\220\353\235\274\355\206\240\355\205\214\353\204\244\354\212\244\354\235\230_\354\262\264_2960_\354\213\244\353\262\2044.py" @@ -0,0 +1,23 @@ +import sys + +sys.stdin = open('input2.txt', 'r') + +n, k = map(int, input().split()) + +# 소수 판별 함수 너무 기얼서 개빡침 암기 ㄱㄱ +소수판별 = lambda n: n > 1 and all(n % i != 0 for i in range(2, int(n**0.5) + 1)) + +arr = list(range(2, n+1)) # [2,3,...,n] +count = 0 + +for i in range(2, n+1): + if 소수판별(i): # 남아 있는 i가 소수면 i = 2,3,4, .. 7 + # i의 배수 제거 + for j in arr: + if j % i == 0: # 2 % 2 == 0 , 4 % 2 == 0 + arr.remove(j) # [2,3,4,5,6,7] => [3,4,5,6,7] / [3,4,5,6,7] => [3,5,6,7] ... + count += 1 + if count == k: + print(j) + + diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" new file mode 100644 index 0000000..56a6051 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input.txt" @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" new file mode 100644 index 0000000..2b8d213 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input2.txt" @@ -0,0 +1 @@ +7 3 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" new file mode 100644 index 0000000..af1e489 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input3.txt" @@ -0,0 +1 @@ +4 2 \ No newline at end of file diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" new file mode 100644 index 0000000..1f5df2c --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 6]/input4.txt" @@ -0,0 +1,2 @@ +5 0 +-7 -3 -2 5 8 \ No newline at end of file From 755f8ff4227062fbff05174cc7c10d61dd4cfa9c Mon Sep 17 00:00:00 2001 From: wjddydwns Date: Thu, 28 Aug 2025 00:06:55 +0900 Subject: [PATCH 07/20] =?UTF-8?q?[BOJ]=20=EC=A0=95=EC=9A=A9=EC=A4=80=20/?= =?UTF-8?q?=20=EA=B1=B0=EC=8A=A4=EB=A6=84=EB=8F=88=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=845=20/=2030=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...17\210_14916_\354\213\244\353\262\2045.py" | 22 +++++++++++++++++++ .../[week 7]/input.txt" | 1 + 2 files changed, 23 insertions(+) create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 7]/[BOJ]\352\261\260\354\212\244\353\246\204\353\217\210_14916_\354\213\244\353\262\2045.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 7]/input.txt" diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 7]/[BOJ]\352\261\260\354\212\244\353\246\204\353\217\210_14916_\354\213\244\353\262\2045.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 7]/[BOJ]\352\261\260\354\212\244\353\246\204\353\217\210_14916_\354\213\244\353\262\2045.py" new file mode 100644 index 0000000..a918bd4 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 7]/[BOJ]\352\261\260\354\212\244\353\246\204\353\217\210_14916_\354\213\244\353\262\2045.py" @@ -0,0 +1,22 @@ +import sys + +sys.stdin = open('input.txt', 'r') + +n = int(input()) +# n=13 + +# for i in range(n // 2 + 1): +# for j in range(n // 2 + 1): +# if(2*i + 5*j == n): +# print(i+j) + +# => 문제 조건이 10^5 이므로 시간초과 +# 2i + 5j = n ==> j =(n-2i)/5 +# 2i < n ... i j =(n-2i)/5 + j = (n - 2*i) // 5 + print(i + j) + break +else: + print(-1) # 불가능한 경우 diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 7]/input.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 7]/input.txt" new file mode 100644 index 0000000..da2d398 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 7]/input.txt" @@ -0,0 +1 @@ +14 \ No newline at end of file From 3c593c4362835a605c4f4be4feb76db675947ef2 Mon Sep 17 00:00:00 2001 From: wjddydwns Date: Wed, 10 Sep 2025 09:58:26 +0900 Subject: [PATCH 08/20] =?UTF-8?q?[BOJ]=20=EC=A0=95=EC=9A=A9=EC=A4=80=20/?= =?UTF-8?q?=20=EB=8B=A4=EB=A6=AC=20=EB=86=93=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=845=20/=2010=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3\352\270\260_1010_\354\213\244\353\262\2045.py" | 13 +++++++++++++ .../[week 9]/input.txt" | 4 ++++ 2 files changed, 17 insertions(+) create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 9]/[BOJ]\353\213\244\353\246\254_\353\206\223\352\270\260_1010_\354\213\244\353\262\2045.py" create mode 100644 "Python/\354\240\225\354\232\251\354\244\200/[week 9]/input.txt" diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 9]/[BOJ]\353\213\244\353\246\254_\353\206\223\352\270\260_1010_\354\213\244\353\262\2045.py" "b/Python/\354\240\225\354\232\251\354\244\200/[week 9]/[BOJ]\353\213\244\353\246\254_\353\206\223\352\270\260_1010_\354\213\244\353\262\2045.py" new file mode 100644 index 0000000..f703e45 --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 9]/[BOJ]\353\213\244\353\246\254_\353\206\223\352\270\260_1010_\354\213\244\353\262\2045.py" @@ -0,0 +1,13 @@ +import math +import sys + +# 이거 그냥 확통문제 아님?? +# 29C13 사이트 29개중에서 순서 상관없이 13개의 사이트 고르면 되는거 아닌가 싶다 +# 조건이 겹치면 안되고, 같은곳 안되고 그럼 검은공 29개에서 13개를 랜덤으로 뽑는다 +sys.stdin = open('input.txt', 'r') +TestCase = int(input()) + +for i in range(0,TestCase): + n,m = map(int, input().split()) + print(math.comb(m,n)) + diff --git "a/Python/\354\240\225\354\232\251\354\244\200/[week 9]/input.txt" "b/Python/\354\240\225\354\232\251\354\244\200/[week 9]/input.txt" new file mode 100644 index 0000000..2ad5ffa --- /dev/null +++ "b/Python/\354\240\225\354\232\251\354\244\200/[week 9]/input.txt" @@ -0,0 +1,4 @@ +3 +2 2 +1 5 +13 29 \ No newline at end of file From 754ad62dbf2baf94ddcc2a31b4d6066a146fae71 Mon Sep 17 00:00:00 2001 From: Yang-Chaeyeon Date: Mon, 22 Sep 2025 20:24:32 +0900 Subject: [PATCH 09/20] =?UTF-8?q?[BOJ]=20=EC=96=91=EC=B1=84=EC=97=B0=20/?= =?UTF-8?q?=201=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=843=20/=2015?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1463_\354\213\244\353\262\2043.java" | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 "Java/\354\226\221\354\261\204\354\227\260/[Week 9]DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" diff --git "a/Java/\354\226\221\354\261\204\354\227\260/[Week 9]DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" "b/Java/\354\226\221\354\261\204\354\227\260/[Week 9]DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" new file mode 100644 index 0000000..4878855 --- /dev/null +++ "b/Java/\354\226\221\354\261\204\354\227\260/[Week 9]DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" @@ -0,0 +1,25 @@ +import java.io.*; +import java.util.*; + +public class Main { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int x = Integer.parseInt(br.readLine()); + int[] arr = new int[x + 1]; + arr[1] = 0; + + for (int i = 2; i <= x; i++) { + if(i%6==0){ + arr[i] = Math.min(Math.min(arr[i/3]+1,arr[i/2]+1),arr[i-1]+1); + }else if(i%3==0){ + arr[i] = Math.min(arr[i/3]+1, arr[i-1]+1); + }else if(i%2==0){ + arr[i] = Math.min(arr[i/2]+1, arr[i-1]+1); + }else{ + arr[i] = arr[i-1]+1; + } + } + System.out.println(arr[x]); + + } +} From 6a3c0a2ca1db53cc343718418d60231b3ebc30a4 Mon Sep 17 00:00:00 2001 From: Yang-Chaeyeon <51074379+Yang-Chaeyeon@users.noreply.github.com> Date: Sun, 28 Sep 2025 15:25:52 +0900 Subject: [PATCH 10/20] =?UTF-8?q?Docs:=20Readme=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f99cde..0ca6823 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,8 @@ git commit -m "[PGS] 이종혁 / Hello World / 브론즈5 / 10 " | Week5 | 25.08.13 | Brute Force Search(완전탐색) | [블랙잭](https://www.acmicpc.net/problem/2798)
[분해합](https://www.acmicpc.net/problem/2231)
[소수찾기](https://school.programmers.co.kr/learn/courses/30/lessons/42839)
[바이러스 (그래프)](https://www.acmicpc.net/problem/2606)
[전력망을 둘로 나누기](https://school.programmers.co.kr/learn/courses/30/lessons/86971) |

Lv.2

Lv.2
| 조원희 | | Week6 | 25.08.20 | Mathematics(수학)


Backtracking(백트래킹) | [더하기 사이클](https://www.acmicpc.net/problem/1110)
[에라토스테네스의 체](https://www.acmicpc.net/problem/2960)

[N과 M(1)](https://www.acmicpc.net/problem/15649)
[부분 수열의 합](https://www.acmicpc.net/problem/1182)
[스도쿠](https://www.acmicpc.net/problem/2580)
|





| 조원희 | | Week7 | 25.08.27 | Greedy1(그리디) | [거스름돈](https://www.acmicpc.net/problem/14916)
[문서 검색](https://www.acmicpc.net/problem/1543)
[체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862)
[카약과 강풍](https://www.acmicpc.net/problem/2891)
[등수 매기기](https://www.acmicpc.net/problem/2012)
|

Lv.1


| 조원희 | -| Week8 | 25.09.03 | Greedy2(그리디) | 지붕잃고 외양간 고치기
[강의실 배정](https://www.acmicpc.net/problem/11000)
[섬 연결하기](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | ?

Lv.3 | 조원희 | +| Week8 | 25.09.03 | Greedy2(그리디) | 지붕잃고 외양간 고치기
[강의실 배정](https://www.acmicpc.net/problem/11000)
[섬 연결하기](https://school.programmers.co.kr/learn/courses/30/lessons/42861) | -

Lv.3 | 조원희 | | Week9 | 25.09.10 | Dynamic Programming1(동적 계획법) | [다리 놓기](https://www.acmicpc.net/problem/1010)
[1로 만들기](https://www.acmicpc.net/problem/1463)|
| 조원희 | | Week10 | 25.09.17 | Dynamic Programming2(동적 계획법) | [가장 긴 증가하는 부분 수열](https://www.acmicpc.net/problem/11053)
[가장 긴 바이토닉 부분 수열](https://www.acmicpc.net/problem/11054)
[정수 삼각형](https://school.programmers.co.kr/learn/courses/30/lessons/43105)
[0/1 Knapsack](https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AWBJAVpqrzQDFAWr&)|

Lv.3
D3 | 조원희 | +| Week11 | 25.09.24 | - | - | - | - | +| Week12 | 25.10.01 | Data Structure(자료구조)
   - Heap(힙)
   - Priority Queue(우선순위 큐)

Graph Theory(그래프 이론)|[최대 힙](https://www.acmicpc.net/problem/11279)
[최소 힙](https://www.acmicpc.net/problem/1927)
[더 맵게](https://school.programmers.co.kr/learn/courses/30/lessons/42626)

[연결 요소의 개수](https://www.acmicpc.net/problem/11724)|

Lv.2


| 조원희 | From 3a144c069b1b1bc9d94c1d3b5791582c349ec383 Mon Sep 17 00:00:00 2001 From: wo-oaw Date: Wed, 10 Sep 2025 08:55:18 +0900 Subject: [PATCH 11/20] =?UTF-8?q?[BOJ]=20=EC=9E=84=EA=B1=B4=EC=95=A0=20/?= =?UTF-8?q?=20=EB=8B=A4=EB=A6=AC=20=EB=86=93=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=84=205=20/=2020=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1010_\354\213\244\353\262\2045.java" | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 "Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" diff --git "a/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" "b/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" new file mode 100644 index 0000000..37b6897 --- /dev/null +++ "b/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] \353\213\244\353\246\254 \353\206\223\352\270\260_1010_\354\213\244\353\262\2045.java" @@ -0,0 +1,37 @@ +import java.util.*; +import java.io.*; + +class Main +{ + public static long comb(int N, int M) { + if (N > M - N) N = M - N; + + long result = 1; + for (int i = 0; i < N; i++) { + result = result * (M - i) / (i + 1); + } + + return result; + } + + public static void main (String[] args) throws IOException + { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int T = Integer.parseInt(br.readLine()); + int[] N = new int[T]; + int[] M = new int[T]; + + StringTokenizer st; + for (int i = 0; i < T; i++) { + st = new StringTokenizer(br.readLine()); + + N[i] = Integer.parseInt(st.nextToken()); + M[i] = Integer.parseInt(st.nextToken()); + + System.out.println(comb(N[i], M[i])); + } + + br.close(); + } +} \ No newline at end of file From 3230af5927fc09b40078492b435ba47f6528ce20 Mon Sep 17 00:00:00 2001 From: wo-oaw Date: Wed, 10 Sep 2025 09:12:04 +0900 Subject: [PATCH 12/20] =?UTF-8?q?[BOJ]=20=EC=9E=84=EA=B1=B4=EC=95=A0=20/?= =?UTF-8?q?=201=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=84=203=20/=2010=EB=B6=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1463_\354\213\244\353\262\2043.java" | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 "Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" diff --git "a/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" "b/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" new file mode 100644 index 0000000..0e17a55 --- /dev/null +++ "b/Java/\354\236\204\352\261\264\354\225\240/[Week 9]DP/[BOJ] 1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\2043.java" @@ -0,0 +1,34 @@ +import java.util.*; +import java.io.*; + +class Main +{ + + public static void main (String[] args) throws IOException + { + Scanner sc = new Scanner(System.in); + + int N = sc.nextInt(); + + int[] arr = new int[N + 1]; + + for (int i = 2; i <= N; i++){ + int temp = arr[i - 1] + 1; + + if (i % 2 == 0) { + temp = Math.min(temp, arr[i / 2] + 1); + } + + if (i % 3 == 0) { + temp = Math.min(temp, arr[i / 3] + 1); + } + + arr[i] = temp; + } + + System.out.println(arr[N]); + + sc.close(); + } + +} \ No newline at end of file From d00a4393b331c4fded4504bdda0b1fe7ff5a36c0 Mon Sep 17 00:00:00 2001 From: Ju-Min-Kyung Date: Wed, 10 Sep 2025 16:18:37 +0900 Subject: [PATCH 13/20] =?UTF-8?q?=EC=A3=BC=EB=AF=BC=EA=B2=BD=20/=20?= =?UTF-8?q?=EB=8B=A4=EB=A6=AC=EB=86=93=EA=B8=B0=20/=20=EC=8B=A4=EB=B2=84?= =?UTF-8?q?=205=20/=2030?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 "Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" diff --git "a/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" "b/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" new file mode 100644 index 0000000..e69de29 From 5c401603612c629a95fae910e0f9610dd5624e87 Mon Sep 17 00:00:00 2001 From: Ju-Min-Kyung Date: Wed, 10 Sep 2025 16:19:39 +0900 Subject: [PATCH 14/20] =?UTF-8?q?=20=EC=A3=BC=EB=AF=BC=EA=B2=BD=20/=201?= =?UTF-8?q?=EB=A1=9C=20=EB=A7=8C=EB=93=A4=EA=B8=B0=20/=20=EC=8B=A4?= =?UTF-8?q?=EB=B2=84=203=20/=2050?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1463_\354\213\244\353\262\204 3.java" | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 "Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\204 3.java" diff --git "a/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\204 3.java" "b/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\204 3.java" new file mode 100644 index 0000000..78e6f9a --- /dev/null +++ "b/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]1\353\241\234 \353\247\214\353\223\244\352\270\260_1463_\354\213\244\353\262\204 3.java" @@ -0,0 +1,18 @@ +import java.util.*; +class Main { + public static void main(String[] args) throws Exception { + Scanner sc = new Scanner(System.in); + int N = sc.nextInt(); + + int[] dp = new int[N + 1]; + dp[1] = 0; + + for (int i = 2; i <= N; i++) { + dp[i] = dp[i - 1] + 1; + if (i % 2 == 0) dp[i] = Math.min(dp[i], dp[i / 2] + 1); + if (i % 3 == 0) dp[i] = Math.min(dp[i], dp[i / 3] + 1); + } + + System.out.println(dp[N]); + } +} \ No newline at end of file From 0b9e6fa5f9e5306a6a8c5c81b67781d7bcb73e85 Mon Sep 17 00:00:00 2001 From: Ju-Min-Kyung Date: Wed, 10 Sep 2025 16:22:35 +0900 Subject: [PATCH 15/20] =?UTF-8?q?fix:=20=EB=8B=A4=EB=A6=AC=EB=86=93?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\260_1010_\354\213\244\353\262\2043.java" | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git "a/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" "b/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" index e69de29..e4b9251 100644 --- "a/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" +++ "b/Java/\354\243\274\353\257\274\352\262\275/[Week 7] DP/[BOJ]\353\213\244\353\246\254\353\206\223\352\270\260_1010_\354\213\244\353\262\2043.java" @@ -0,0 +1,44 @@ +import java.util.*; +import java.lang.*; +import java.io.*; + +class Main +{ + public static int[][] inputArray; + public static Long[][] memo; + public static void main (String[] args) throws java.lang.Exception + { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + + int T = Integer.parseInt(br.readLine()); + inputArray = new int[T][2]; + + for (int i = 0; i < T; i++) { + StringTokenizer st = new StringTokenizer(br.readLine()); + inputArray[i][0] = Integer.parseInt(st.nextToken()); + inputArray[i][1] = Integer.parseInt(st.nextToken()); + } + + for (int i = 0; i < T; i++) { + int r = inputArray[i][0]; + int n = inputArray[i][1]; + + memo = new Long[n+1][r+1]; + Long result = memoization(n, r); + System.out.println(result); + } + } + + public static long memoization(int n, int r) { + if ((r == 0) || n == r) { + return 1L; + } + + if (memo[n][r] != null) { + return memo[n][r]; + } + + memo[n][r] = memoization(n-1, r-1) + memoization(n-1, r); + return memo[n][r]; + } +} From a1f77c2890cda6b1fe8ff0b8f71c29fe6d3aed7c Mon Sep 17 00:00:00 2001 From: JBLee Date: Wed, 1 Oct 2025 17:46:56 +0900 Subject: [PATCH 16/20] =?UTF-8?q?[BOJ]=20=EC=9D=B4=EC=A0=95=EB=B3=B5=20/?= =?UTF-8?q?=20=EC=B5=9C=EC=86=8C=20=ED=9E=99=20/=20=EC=8B=A4=EB=B2=84=202?= =?UTF-8?q?=20/=2015?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...6\231_1927_\354\213\244\353\262\2042.java" | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\354\206\214 \355\236\231_1927_\354\213\244\353\262\2042.java" diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\354\206\214 \355\236\231_1927_\354\213\244\353\262\2042.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\354\206\214 \355\236\231_1927_\354\213\244\353\262\2042.java" new file mode 100644 index 0000000..64e59d2 --- /dev/null +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\354\206\214 \355\236\231_1927_\354\213\244\353\262\2042.java" @@ -0,0 +1,33 @@ +package week11; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.PriorityQueue; + +public class Minheap { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int count = Integer.parseInt(br.readLine()); + int op = 0; + + // PriorityQueue의 Default 설정이 최소힙 + PriorityQueue heap = new PriorityQueue<>(); + + for (int i=0; i Date: Wed, 1 Oct 2025 17:47:18 +0900 Subject: [PATCH 17/20] =?UTF-8?q?[BOJ]=20=EC=9D=B4=EC=A0=95=EB=B3=B5=20/?= =?UTF-8?q?=20=EC=B5=9C=EB=8C=80=20=ED=9E=99=20/=20=EC=8B=A4=EB=B2=84=202?= =?UTF-8?q?=20/=205?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\231_11279_\354\213\244\353\262\2042.java" | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\353\214\200 \355\236\231_11279_\354\213\244\353\262\2042.java" diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\353\214\200 \355\236\231_11279_\354\213\244\353\262\2042.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\353\214\200 \355\236\231_11279_\354\213\244\353\262\2042.java" new file mode 100644 index 0000000..aa1e51d --- /dev/null +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[BOJ] \354\265\234\353\214\200 \355\236\231_11279_\354\213\244\353\262\2042.java" @@ -0,0 +1,32 @@ +package week11; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Collections; +import java.util.PriorityQueue; + +public class Maxheap { + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int count = Integer.parseInt(br.readLine()); + int op = 0; + + // 최소힙 문제와 완전히 동일하지만, Collections.reverseOrder()를 줘서 최대힙으로 사용 + PriorityQueue heap = new PriorityQueue<>(Collections.reverseOrder()); + + for (int i=0; i Date: Wed, 1 Oct 2025 17:47:54 +0900 Subject: [PATCH 18/20] =?UTF-8?q?[PGS]=20=EC=9D=B4=EC=A0=95=EB=B3=B5=20/?= =?UTF-8?q?=20=EB=8D=94=20=EB=A7=B5=EA=B2=8C=20/=20Level2=20/=2020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\224 \353\247\265\352\262\214_Level2.java" | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[PGS] \353\215\224 \353\247\265\352\262\214_Level2.java" diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[PGS] \353\215\224 \353\247\265\352\262\214_Level2.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[PGS] \353\215\224 \353\247\265\352\262\214_Level2.java" new file mode 100644 index 0000000..4e42681 --- /dev/null +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week11]Heap, UnionFind/[PGS] \353\215\224 \353\247\265\352\262\214_Level2.java" @@ -0,0 +1,45 @@ +package week11; + +import java.util.PriorityQueue; + +class Solution { + // 최소힙 사용 + PriorityQueue minHeap = new PriorityQueue<>(); + + public int solution(int[] scoville, int K) { + int answer = 0; + + for (int i : scoville) { + minHeap.add(i); + } + + // minHeap의 최소값이 K보다 작은 경우 계속 반복 + while(minHeap.peek() < K){ + try { + mix(scoville); + } catch (NullPointerException e) { + /* + NullPointerException이 발생했다면 + 1. while문에서 k값을 넘지 않는 값이 있다는 것을 확인했고 + 2. Null이 반환되었다면 힙에 남은 항목이 1이었다는 것 + -> 따라서 k보다 매운 음식을 만들 수 없는 상황. -1을 출력 + */ + return -1; + } + answer++; + } + + return answer; + } + + private int mix(int[] scoville) throws NullPointerException{ + Integer min = minHeap.poll(); + Integer min2 = minHeap.poll(); + + // 여기서 result가 Null이라면 NullPointerException 발생 (큐가 비어있었다면) + int result = min + min2*2; + minHeap.add(result); + + return result; + } +} \ No newline at end of file From 9d6f31dc8037f375ba10eb2887064769c647132a Mon Sep 17 00:00:00 2001 From: JBLee Date: Wed, 29 Oct 2025 18:10:52 +0900 Subject: [PATCH 19/20] =?UTF-8?q?[PGS]=20=EC=9D=B4=EC=A0=95=EB=B3=B5=20/?= =?UTF-8?q?=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20/=20LV3=20/=2050?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7\210_1679_\354\213\244\353\262\2041.java" | 64 +++++++++++++++++++ ...3\250\352\261\260\353\246\254_Level2.java" | 54 ++++++++++++++++ ...2\270\354\233\214\355\201\254_Level3.java" | 0 3 files changed, 118 insertions(+) create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[BOJ] \354\210\250\353\260\224\352\274\255\354\247\210_1679_\354\213\244\353\262\2041.java" create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \352\262\214\354\236\204 \353\247\265 \354\265\234\353\213\250\352\261\260\353\246\254_Level2.java" create mode 100644 "Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[BOJ] \354\210\250\353\260\224\352\274\255\354\247\210_1679_\354\213\244\353\262\2041.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[BOJ] \354\210\250\353\260\224\352\274\255\354\247\210_1679_\354\213\244\353\262\2041.java" new file mode 100644 index 0000000..cf56e3e --- /dev/null +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[BOJ] \354\210\250\353\260\224\352\274\255\354\247\210_1679_\354\213\244\353\262\2041.java" @@ -0,0 +1,64 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + +/* + 의문점 + 해당 로직은 최소 깊이를 찾는 것이 아닌, 가장 먼저 만난 상황에서의 깊이를 찾는 로직 + 채점을 했을 때는 정답으로 나오기는 하는데, 이유가 무엇일지 고민해봐도 모르겠습니다. + */ + +public class Main { + private static Queue queue = new LinkedList<>(); + private static boolean[] visited = new boolean[100001]; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + StringTokenizer st = new StringTokenizer(br.readLine()); + int soobin = Integer.parseInt(st.nextToken()); // 수빈이 출발하는 위치 + int sister = Integer.parseInt(st.nextToken()); // 동생의 위치 + + // 수빈이 출발하는 지점을 깊이 0으로 세팅 + queue.add(new int[]{soobin, 0}); + visited[soobin] = true; + System.out.println(bfs(sister)); + } + + // 현재 점의 정수를 큐에 넣으며 bfs 탐색을 진행한다. + private static int bfs(int sister) { + int curr, temp, depth=0; + + while (!queue.isEmpty()) { + // 큐에서 현재 지점과 깊이를 가져옴 + int[] data = queue.poll(); + curr = data[0]; + depth = data[1]; + + // 동생을 만났다면 깊이 리턴 + if(sister == curr) + return depth; + + // 가능한 연산들을 큐에 추가 + temp = curr * 2; + if(temp <= 100000 && visited[temp] == false) { + queue.add(new int[]{temp, depth + 1}); + visited[temp] = true; + } + + temp = curr - 1; + if(temp >= 0 && visited[temp] == false){ + queue.add(new int[]{temp, depth + 1}); + visited[temp] = true; + } + + temp = curr +1; + if(temp <= 100000 && visited[temp] == false){ + queue.add(new int[]{temp, depth + 1}); + visited[temp] = true; + } + } + // 탐색실패, 문제 조건 상 도달할 수는 없음 + return -1; + } +} \ No newline at end of file diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \352\262\214\354\236\204 \353\247\265 \354\265\234\353\213\250\352\261\260\353\246\254_Level2.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \352\262\214\354\236\204 \353\247\265 \354\265\234\353\213\250\352\261\260\353\246\254_Level2.java" new file mode 100644 index 0000000..b5f90ae --- /dev/null +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \352\262\214\354\236\204 \353\247\265 \354\265\234\353\213\250\352\261\260\353\246\254_Level2.java" @@ -0,0 +1,54 @@ +import java.util.ArrayList; +import java.util.Queue; +import java.util.LinkedList; + +class Solution { + public int solution(int[][] maps) { + // 배열의 길이 설정 + int rowLength = maps.length; + int colLength = maps[0].length; + + // 2차원 배열을 벽으로 한 줄씩 패딩 > 탐색 시 코드 가독성 개선 (조건문 최소화) + int[][] padded = new int[rowLength+2][colLength+2]; // 패딩된 maps 배열 + boolean[][] visited = new boolean[rowLength+2][colLength+2]; // visited + Queue queue = new LinkedList<>(); // 탐색에 사용할 큐 + + for (int i = 0; i < rowLength; i++) { + for (int j = 0; j < colLength; j++) { + padded[i + 1][j + 1] = maps[i][j]; + } + } + + // 초기 위치 설정 + visited[1][1] = true; + queue.add(new int[]{1, 1, 0}); // {x, y, depth} + + int[] dirX = {0, 0, +1, -1}; + int[] dirY = {+1, -1, 0, 0}; + + while(!queue.isEmpty()) { + int[] data = queue.poll(); + int x = data[0]; + int y = data[1]; + int depth = data[2] + 1; + + // 도착 위치라면 깊이를 리턴 + if (x == rowLength && y == colLength){ + return depth; + } else { + for(int i=0; i<4; i++) { + int newX = x + dirX[i]; + int newY = y + dirY[i]; + + if(padded[newX][newY] == 1 && visited[newX][newY] == false){ + queue.add(new int[]{newX, newY, depth}); + visited[newX][newY] = true; + } + } + } + } + + // 탐색실패 + return -1; + } +} \ No newline at end of file diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" new file mode 100644 index 0000000..e69de29 From 27149094b881a5c5612001245b59c9fb134a382a Mon Sep 17 00:00:00 2001 From: JBLee <120627991+JBL28@users.noreply.github.com> Date: Wed, 29 Oct 2025 18:30:50 +0900 Subject: [PATCH 20/20] =?UTF-8?q?Update=20[PGS]=20=EB=84=A4=ED=8A=B8?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=5FLevel3.java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2\270\354\233\214\355\201\254_Level3.java" | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git "a/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" index e69de29..6731c27 100644 --- "a/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" +++ "b/Java/\354\235\264\354\240\225\353\263\265/[Week14]dfs, bfs/[PGS] \353\204\244\355\212\270\354\233\214\355\201\254_Level3.java" @@ -0,0 +1,63 @@ +import java.util.HashSet; + +class Solution { + private static int n; + private int[][] computers; + + // 접근 : UNION-FIND? + // 알고리즘 정석대로 풀지는 않고,(Union을 만들어주지 않고) + // 연결된 네트워크에서 가장 큰 값을 갖는 노드를 대표값으로 설정하고 + // 완성된 대표값의 종류를 세는 방법으로 해결했습니다. + // GPT한테 물어보니깐 이 로직은 실제 Union-Find처럼 방향 그래프까지 커버하지는 못한다고 하네요 + public int solution(int n, int[][] computers) { + this.n = n; + this.computers = computers; + int[] represent = new int[n]; + + // 대표값을 자기 자신으로 초기화 + for (int i = 0; i < n; i++) { + represent[i] = i; + System.out.printf("%d ", represent[i]); + } + System.out.println(); + + // 각 노드마다 DFS 돌려서 '해당 노드가 속한 것의 최대 인덱스'를 대표값으로 저장 + for (int i = 0; i < n; i++) { + int[] visited = new int[n]; // i마다 방문 기록 새로 + int max = findMaxDFS(visited, i); + represent[i] = max; // i의 대표값은 max라고 가정 + System.out.printf("%d -> %d%n", i, max); + } + + // represent 배열 안에 있는 값들의 고유 개수 세기 + HashSet set = new HashSet<>(); + for (int i = 0; i < n; i++) { + set.add(represent[i]); + } + + int answer = set.size(); + System.out.println("distinct reps = " + answer); + + return answer; + } + + // 각 노드에 대해 탐색할 때마다 visited를 초기화해야함 + int findMaxDFS(int[] visited, int curr) { + // 지금 노드를 방문처리 + visited[curr] = 1; + int max = curr; + + // curr에서 갈 수 있는 모든 노드 탐색 + for (int i = 0; i < n; i++) { + // 연결되어 있고 아직 방문 안 했으면 DFS 진행 + if (computers[curr][i] == 1 && visited[i] == 0) { + int childMax = findMaxDFS(visited, i); + if (max < childMax) { + max = childMax; + } + } + } + + return max; + } +}