CS/Algorithm

CS/Algorithm

[백준:2210] 숫자판 점프 - JAVA

import java.util.Scanner; import java.util.HashSet; public class Main { static int[] dx = {-1,1,0,0}; static int[] dy = {0,0,-1,1}; static int[][] arr; static HashSet list; static int N; public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); N = 5; list = new HashSet(); arr = new int[N][N]; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { arr[i]..

CS/Algorithm

[백준 : 4889] 안정적인 문자열 - JAVA

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); Stack stack = new Stack(); int no = 1;//출력할 때 number //TestCase가 안정해져있기에 while문으로 입력을 받..

CS/Algorithm

[백준:3986번] 좋은 단어 - JAVA

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { public static int GoodLetter(String input) { Stack s = new Stack(); for(int i = 0; i < input.length(); i++) { char c = input.charAt(i); if(!s.empty()&&s.peek().equals(c)) { s.pop(); } else { s.add(c); } } if(s.isEmpty()) return 1; else return 0; } public static..

CS/Algorithm

[백준:1935] 후위 표기식2 - JAVA

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int[] arr = new int[N]; Stacks = new Stack(); String str = br.readLine(); for(int i = ..

yujindonut
'CS/Algorithm' 카테고리의 글 목록 (24 Page)