PS
-
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
-
boj)9095 - 1, 2, 3 더하기PS/boj 2020. 9. 16. 18:56
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; // # 1, 2, 3 더하기 public class boj_9095 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int[] dp = new int[11]; public static void main(String[] args) throws IOException { int t = Integer.parseInt(br.readLine()); dp[1] = 1; dp[2] = 2; dp[3] = 4; for (int i = 4; i ..
-
boj)11727 - 2xn 타일링 2PS/boj 2020. 9. 16. 18:24
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; // # 2xn 타일링 2 public class boj_11727 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int[] dp = new int[1001]; public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); dp[1] = 1; dp[2] = 3; for (int i = 3; i
-
boj)11726 - 2xn 타일링PS/boj 2020. 9. 16. 18:12
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; // # 2xn 타일링 public class boj_11726 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int[] dp = new int[1001]; public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); dp[1] = 1; dp[2] = 2; for (int i = 3; i
-
boj)1463 - 1로 만들기PS/boj 2020. 9. 16. 17:37
import java.io.*; // # 1로 만들기 public class boj_1463 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static int[] dp = new int[1000001]; public static void main(String[] args) throws IOException { int n = Integer.parseInt(br.readLine()); dp[2] = 1; dp[3] = 1; for (int i = 4; i
-
boj)17103 - 골드바흐 파티션PS/boj 2020. 9. 16. 16:10
import java.io.*; // # 골드바흐 파티션 public class boj_17103 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static boolean[] prime = new boolean[1000001]; static int ans; public static void main(String[] args) throws IOException { // 1. 1,000,001 이하의 소수 담기 for (int i = 2; i < prime.le..
-
boj)1212 - 8진수 2진수PS/boj 2020. 9. 16. 15:15
import java.util.Scanner; // # 8진수 2진수 public class boj_1212 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); String[] arr = {"000", "001", "010", "011", "100", "101", "110", "111"}; String s = sc.nextLine(); // 2진수 0이 되는 경우 if (s.length() == 1 && s.charAt(0) == '0') { sb.append(0); } else { for (int i = 0; i < s.length(); i+..
-
boj)1373 - 2진수 8진수PS/boj 2020. 9. 16. 14:25
import java.util.Scanner; // # 2진수 8진수 public class boj_1373 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); String s = sc.nextLine(); int n = s.length(); if (n % 3 == 1) { sb.append(s.charAt(0)); } else if (n % 3 == 2) { sb.append((s.charAt(0)-'0')*2 + (s.charAt(1)-'0')); } for (int i = n%3; i < n; i+=3) { sb.append((s.char..