동적계획법2 백준 2133 ▶ 2133문제 - 타일 채우기 ▶ 풀이방법 import java.io.*; 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)); int num = Integer.parseInt(br.readLine()); int[] dp = new int[num+1]; dp[0] = 1; if(num > 1) dp[2] = 3; // 1이하일때 런타임 에러 발생하므로 1.. 2022. 3. 29. 백준 9095 ▶ 9095번 문제 ▶풀이 방법 import java.io.*; public class Main{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int count = Integer.parseInt(br.readLine()); int[] dp = new int[11]; dp[1] = 1; dp[2] = 2; dp[3] = 4; for(int j = 0; j < count; j++) { int num = Integer.parseInt(br.readLine()); for(int i = 4; i 2022. 3. 20. 이전 1 다음