PS/boj
-
boj)2493 - 탑PS/boj 2020. 10. 12. 13:02
import java.io.*; import java.util.*; public class boj_2493 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); static Stack waiting = new Stack(); static Stack pending = new Stack(); static StringTokenizer st; public static void main(String[] args) throws IOException { int n = Integ..
-
boj)10773 - 제로PS/boj 2020. 10. 12. 11:08
import java.io.*; import java.util.Stack; public class boj_10773 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static Stack s = new Stack(); public static void main(String[] args) throws IOException { long ans = 0; int k = Integer.parseInt(br.readLine()); for (int i = 0; i < k; i++) { int val = Integer.parseInt(br.readLine()); if (val == 0) { ans -= s.pop(); ..
-
boj)1748 - 수 이어쓰기 1PS/boj 2020. 9. 22. 17:32
import java.io.*; public class boj_1748 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String n = br.readLine(); int N = Integer.parseInt(n); int ans = 0; for (int i = 1; i
-
boj)6064 - 카잉 달력PS/boj 2020. 9. 22. 16:33
import java.io.*; import java.util.StringTokenizer; public class boj_6064 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; public static void main(String[] args) throws IOException { int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) { st = new StringTokenizer(br.readLine()); int m = Integer.parseInt(st.nextToken()); ..
-
boj)14500 - 테트로미노PS/boj 2020. 9. 22. 12:00
import java.io.*; import java.util.StringTokenizer; public class boj_14500 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static int[][] a; public static void main(String[] args) throws IOException { st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); a = new in..
-
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 =..