PS/boj
-
boj)4179 - 불!PS/boj 2020. 10. 17. 16:59
import java.io.*; import java.util.*; public class boj_4179 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static Queue qF = new LinkedList(); static Queue qJ = new LinkedList(); static char[][] a; static int row, col, nx, ny, ans; static int[] dx = {-1, 1, 0, 0}; static int[] dy = {0, 0, -1, 1}; public static void main(String[] args..
-
boj)1926 - 그림PS/boj 2020. 10. 15. 18:16
import java.io.*; import java.util.*; public class boj_1926 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; static Queue q = new LinkedList(); static int[][] a; static boolean[][] v; static int n, m, size; static List sizeList = new ArrayList(); static int[] lx = {-1, 1, 0, 0}; static int[] ly = {0, 0, -1, 1}; public static void main(..
-
boj)10866 - 덱PS/boj 2020. 10. 14. 21:17
import java.io.*; public class boj_10866 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public static void main(String[] args) throws IOException { int N = Integer.parseInt(br.readLine()); int[] arr = new int[(N*2) + 2]; int head = N; int tail = N; for (int i = 0; i < N; i++) { ..
-
boj)4889 - 안정적인 문자열PS/boj 2020. 10. 14. 15:48
import java.io.*; import java.util.Stack; public class boj_4889 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); String str; int cnt = 0; while ( !(str = br.readLine()).contains("-") ) { cnt++; Stack stack = new Stack(); for (int i = 0..
-
boj)2504 - 괄호의 값PS/boj 2020. 10. 14. 14:42
import java.io.*; import java.util.*; public class boj_2504 { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); String str = sc.nextLine(); Stack stack = new Stack(); int roundBracket = 0; int squareBracket = 0; for (int i = 0; i < str.length(); i++) { String s = str.substri..
-
boj)4949 - 균형잡힌 세상PS/boj 2020. 10. 13. 17:49
import java.io.*; import java.util.*; public class boj_4949 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws IOException { while (true) { String input = br.readLine(); if (input.equals(".")) { break; } sb.append(solve(input) ? "yes" : "no").append("\n"); } System.out.pri..
-
boj)6198 - 옥상 정원 꾸미기PS/boj 2020. 10. 13. 12:57
import java.io.*; import java.util.*; public class boj_6198 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static Stack stack = new Stack(); public static void main(String[] args) throws IOException { long ans = 0; int N = Integer.parseInt(br.readLine()); for (int i = 0; i < N; i++) { int height = Integer.parseInt(br.readLine()); while (!stack.isEmpty()) { if ..
-
boj)2164 - 카드2PS/boj 2020. 10. 12. 16:28
import java.io.*; import java.util.*; public class boj_2164 { static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { Queue q = new LinkedList(); int N = Integer.parseInt(br.readLine()); for (int i = 1; i