PS/boj
-
boj)2309 - 일곱 난쟁이PS/boj 2020. 9. 21. 19:11
import java.io.*; import java.util.Arrays; public class boj_2309 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int[] a = new int[9]; static int sum; public static void main(String[] args) throws IOException { for (int i = 0; i < 9; i++) { a[i] = Integer.parseInt(br.readLine()); sum += a[i]; } Arrays.sort(a); for (int i = 0; i < 9; i++) { for (int j = i..
-
boj)2133 - 타일 채우기PS/boj 2020. 9. 21. 17:53
import java.io.*; public class boj_2133 { static long[] d; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); d = new long[n+1]; d[0] = 1; for (int i = 2; i = 0; j-=2) { d[i] += d[j] * 2; } } System.out.println(d[n]); } } - 마지막 부분에 초점을 맞춤, 일단 n이 홀수일때는 채울 수 있는 방법이 없음 ..
-
boj)13398 - 연속합 2PS/boj 2020. 9. 21. 17:08
import java.io.*; import java.util.StringTokenizer; public class boj_13398 { static int[] dl; // i 번째를 마지막으로 하는 연속합 static int[] dr; // i 번째를 시작으로 하는 연속합 static int[] a; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); dl = new int[n+1]; dr = new int[n+1]; a = new ..
-
boj)11054 - 가장 긴 바이토닉 부분 수열PS/boj 2020. 9. 20. 20:29
import java.io.*; import java.util.StringTokenizer; public class Main { static int[] d; static int[] dl; static int[] dr; static int[] val; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); d = new int[n+1]; dl = new int[n+1]; dr = new int[n+1]; val = new int[n+1]; ..
-
boj)11722 - 가장 긴 감소하는 부분 수열PS/boj 2020. 9. 20. 14:35
import java.io.*; import java.util.StringTokenizer; public class boj_11722 { static int[] dp; static int[] val; static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); dp = new int[n+1]; val = new int[n+1]; StringTokenizer st = new StringTokenizer(br.readLine()); for (int..
-
boj)11055 - 가장 큰 증가 부분 수열PS/boj 2020. 9. 19. 20:34
import java.io.*; import java.util.StringTokenizer; public class boj_11055 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static int[] dp; static int[] val; static int n, ans; public static void main(String[] args) throws IOException { n = Integer.parseInt(br.readLine()); dp = new int[n+1]; val = new int[n+1]; st = new StringTokenize..
-
boj)1932 - 정수 삼각형PS/boj 2020. 9. 19. 17:08
import java.io.*; import java.util.StringTokenizer; public class boj_1932 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static long[][] dp; static int[][] val; // 0 ~ 9999 static int n; // 1 ~ 500 public static void main(String[] args) throws IOException { n = Integer.parseInt(br.readLine()); dp = new long[n+1][n+1]; val = new int[n..
-
boj)2156 - 포도주 시식PS/boj 2020. 9. 19. 16:25
import java.io.*; import java.util.StringTokenizer; public class boj_2156 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static long[] dp; static int[] val; static int n; public static void main(String[] args) throws IOException { n = Integer.parseInt(br.readLine()); dp = new long[n+1]; val = new int[n+1]; for (int i = 1; i = 2) { dp[2] = val[1] + val[2]; } fo..