다이나믹 프로그래밍

ALGORITHM

[백준] 1,2,3 더하기 JAVA

동적 계획법 백준 1,2,3 더하기 https://www.acmicpc.net/problem/9095 9095번: 1, 2, 3 더하기 각 테스트 케이스마다, n을 1, 2, 3의 합으로 나타내는 방법의 수를 출력한다. www.acmicpc.net 동적 계획법 DP 를 떠올리며 문제를 풀기는 쉽지 않다. import java.util.Scanner; public class 백준1_2_3더하기 { /* ex ) 3 4 7 10 */ static int[] dp = new int[11]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); dp[1] = 1; dp[2] = 2; //..

ALGORITHM

[LIS] 백준 11053 가장 긴 증가하는 부분 수열

import java.util.*; public class Lis { public static void main(String[] args) { // Scanner sc = new Scanner(System.in); // int size = Integer.parseInt(sc.nextLine()); // String arrays = sc.nextLine(); // String[] ttee = arrays.split(" "); // int[] target = Arrays.stream(ttee).mapToInt(Integer::parseInt).toArray(); int size = 6; int[] target = {10,20,10,30,20,50}; int sol = 0; int[] dp = new int[..

girin_dev
'다이나믹 프로그래밍' 태그의 글 목록