백준_2098 외판워 순회 (DP - TPS)
Algorithm/Algorithm 문제2024. 5. 7. 00:04백준_2098 외판워 순회 (DP - TPS)

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class BJ_2098_외판원순회 { static int n; static int[][] w; static int[][] d; static int INF = 16*1000000 + 1; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ..

백준_11049 행렬 곱셈 순서 (DP)
Algorithm/Algorithm 문제2024. 4. 28. 21:52백준_11049 행렬 곱셈 순서 (DP)

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class BJ_11049_행렬곱셈순서 { static int[][] matrix; static long[][] d; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); ..

백준_2342 Dance Dance Revolution (DP)
Algorithm/Algorithm 문제2024. 4. 23. 22:55백준_2342 Dance Dance Revolution (DP)

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class BJ_2342_DanceDanceRevolution { static int MAX = 10000000; public static void main(String[] args) throws IOException { int[][] m = {{1, 2, 2, 2, 2}, {0, 1, 3, 4, 3}, {0, 3, 1, 3, 4}, ..

백준_1328 고층 빌딩 (DP)
Algorithm/Algorithm 문제2024. 4. 21. 21:01백준_1328 고층 빌딩 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1328_고층빌딩 { static long MOD = 1000000007; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int n = Integer.p..

백준_1915 가장 큰 정사각형 (DP)
Algorithm/Algorithm 문제2024. 4. 21. 00:37백준_1915 가장 큰 정사각형 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1915_가장큰정사각형 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); int n = Integer.parseInt(st.nextToken()); in..

백준_9252 LCS 2 (DP)
Algorithm/Algorithm 문제2024. 4. 21. 00:36백준_9252 LCS 2 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_9252_LCS2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s1 = br.readLine(); String s2 = br.readLine(); int[][] d = new int[s1.length() + 1][s2.length() + 1]; int i, j; for (i = 1; i < s1.lengt..

백준_13398 연속합 2 (DP)
Algorithm/Algorithm 문제2024. 4. 18. 01:50백준_13398 연속합 2 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_13398_연속합2 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] a = new int[n]; int[] l = new int[n]; int[] r = new int[n]; i..

백준_10844 쉬운 계단 수 (DP)
Algorithm/Algorithm 문제2024. 4. 16. 22:42백준_10844 쉬운 계단 수 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_10844_쉬운계단수 { static long M = 1000000000; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long[][] d = new long[n+1][10]; int i, j; for (i=1; i

백준_11726 2xn 타일링 (DP)
Algorithm/Algorithm 문제2024. 4. 15. 22:04백준_11726 2xn 타일링 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_11726_2xN타일링 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] d = new int[n+2]; d[1] = 1; d[2] = 2; for (int i=3; i

백준_2193 이친수 (DP)
Algorithm/Algorithm 문제2024. 4. 14. 17:13백준_2193 이친수 (DP)

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_2193_이친수 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); long[][] d = new long[n+1][2]; //d[i][0] : i번째의 0의 개수, d[i][1] : i번째의 1의 개수 d[1][0] = 0; d[1][1] = 1; f..

image