전체 글
-
boj)1912 - 연속합PS/boj 2020. 9. 18. 01:47
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class boj_1912{ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static int[] a; static int[] dp; public static void main(String[] args) throws IOException { int n = Integer.parseI..
-
boj)14002 - 가장 긴 증가하는 부분 수열 4PS/boj 2020. 9. 18. 00:53
import java.util.Scanner; public class boj_14002 { static int[] arr; static int[] dp; static int[] v; // 출력 함수 static void print(int p) { if (p == 0) return; print(v[p]); System.out.print(arr[p] + " "); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); arr = new int[n+1]; for (int i = 1; i
-
boj)11053 - 가장 긴 증가하는 부분 수열PS/boj 2020. 9. 17. 21:38
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class boj_11053 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); int[] arr = new int[n+1]; int[] dp = new int[n+1]; StringTokeniz..
-
boj)2193 - 이친수PS/boj 2020. 9. 17. 15:53
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; // # 이친수 public class boj_2193 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static long[][] dp = new long[91][2]; public static void main(String[] args) throws Exception { dp[1][1] = 1; for (int i = 2; i
-
boj)10844 - 쉬운 계단 수PS/boj 2020. 9. 17. 15:04
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; // # 쉬운 계단 수 public class boj_10844 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static final long mod = 1000000000L; static long[][] dp = new lon..
-
boj)15590 - 1, 2, 3 더하기 5PS/boj 2020. 9. 17. 14:13
import java.util.*; public class boj_15990 { static final long mod = 1000000009L; static final int limit = 100000; static long[][] d = new long[limit+1][4]; public static void main(String args[]) { Scanner sc = new Scanner(System.in); for (int i=1; i= 0) { d[i][1] = d[i-1][2] + d[i-1][3]; if (i == 1) { d[i][1] = 1; } } if (i-2 >= 0) { d[i][2] = d[i-2][1] + d[i-2][3]; if (i == 2) { d[i][2] = 1; }..
-
boj)16194 - 카드 구매하기 2PS/boj 2020. 9. 17. 13:02
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; // # 카드 구매하기 2 public class boj_16194 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { int n = Integer.parseInt(br.readLine()); StringTokenizer st = new StringTokenizer(br.readLine()..
-
boj)11052 - 카드 구매하기PS/boj 2020. 9. 17. 12:35
import java.io.*; // # 카드 구매하기 public class boj_11052 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { int n = Integer.parseInt(br.readLine()); StringTokenizer st = new StringTokenizer(br.readLine()); int[] p = new int[n+1]; int[] dp = new int[n+1]; for (int i = 1; i