PS
-
boj)1107 - 리모컨PS/boj 2020. 9. 22. 01:50
import java.util.*; public class boj_1107 { static boolean[] broken = new boolean[10]; static int possible(int c) { if (c == 0) { if (broken[0]) { return 0; } else { return 1; } } int len = 0; while (c > 0) { if (broken[c % 10]) { return 0; } len += 1; c /= 10; } return len; } public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt()..
-
boj)1476 - 날짜 계산PS/boj 2020. 9. 21. 21:24
import java.io.*; import java.util.StringTokenizer; public class boj_1476 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { StringTokenizer st = new StringTokenizer(br.readLine()); int E = Integer.parseInt(st.nextToken()); // 1 ~ 15 int S = Integer.parseInt(st.nextToken()); // 1 ~ 28 int M = Integer.pars..
-
boj)3085 - 사탕 게임PS/boj 2020. 9. 21. 20:18
import java.io.*; public class boj_3085 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static char[][] a; // 연속된 길이 체크 static int check(char[][] a) { int n = a.length; int ans = 1; for (int i = 0; i < n; i++) { int cnt = 1; // 같은 행에서의 연속길이 체크 for (int j = 1; j < n; j++) { if (a[i][j] == a[i][j-1]) { cnt ++; } else { cnt = 1; } if (ans < cnt) ans = cnt; } cnt =..
-
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..