DP 28

백준_1010 다리 놓기(자바) /DP

시간&메모리 제한 문제 입력&출력 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_1010 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[][] dp = new int[30][30]; for (int i = 0; i..

백준_1495 기타리스트(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_1495 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); i..

백준_1309 동물원(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Back_1309 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[][] dp = new int[N + 1][..

백준_1965 상자넣기(자바) / 최장 증가 수열(LIS)

시간 & 메모리 제한 문제 문제를 읽어 보면 최장 증가 수열을 이용해야 겠다는 생각이 들었습니다. 입력 & 출력 최장 증가 수열을 이용한 문제 풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; //최장 증가 수열을 구하는 문제... LIS public class Back_1965 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedRead..

백준_9465 스티커(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 - dp 의 값의 크기를 봤을 때, 100000이고 100씩을 반복한다 하더라도 최대 1,000,000 이므로 int로도 충분히 담을 수 있다. DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_9465 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new Buff..

백준_1890 점프(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 DP를 이용한 문제 풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_1890 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int N = Intege..

백준_5557 1학년(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_5557 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLin..

백준_11048 이동하기(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 예제 DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_11048 { static int col, row; static int[][] map; static int[][] dp; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System...

백준_1520 내리막길(자바) / DFS + DP

시간 & 메모리 제한 문제 입력 & 출력 DFS + DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_1520 { static int row,col; static int[][] map; static int[][] dp; static int[] dx = {-1,1,0,0}; static int[] dy = {0,0,-1,1}; public static void main(String[] args) throws IOException { Buffere..

백준_12865 평범한 배낭(자바) / DP

시간 & 메모리 제한 문제 입력 & 출력 & 예제 DP를 이용한 문제풀이 package com.Back; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Back_12865 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine..