dp
-
[백준] 12852 1로 만들기 2#JAVAAlgorithm Solving/BAEKJOON 2021. 2. 27. 18:33
[백준] 12852 1로 만들기 2#JAVA 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); int[] d = new int[..
-
[백준] 1149 RGB거리 #JAVAAlgorithm Solving/BAEKJOON 2021. 2. 27. 00:33
[백준] 1149 RGB거리 #JAVA 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[][] arr = new int[n+1][3]; //arr[i][j] // i번째 집에..
-
[백준] 2579 계단 오르기 #JAVAAlgorithm Solving/BAEKJOON 2021. 2. 26. 23:38
[백준] 2579 계단 오르기 #JAVA 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] arr = new int[n+1]; int[][] d = new int[n+1][3]; //거리 정보를 담을 배열 for (int i = 1;..
-
[백준] 1463 1로 만들기 #JAVA #DPAlgorithm Solving/BAEKJOON 2021. 2. 25. 23:50
[백준] 1463 1로 만들기 #JAVA #DP 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { 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+1]; Arrays.fill(d, Integer.MAX_VALUE..