알고리즘
-
[백준] 6198 옥상 정원 꾸미기 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 31. 00:10
BAEKJOON [6198] 옥상 정원 꾸미기 코드 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()); long result = 0;// (1+80000) /2 * 80000 > Integer.MAX_VAL..
-
[백준] 1874 스택 수열 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 30. 17:30
BAEKJOON [1874] 스택 수열 코드 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)); //BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); StringBuilder sb = new St..
-
[해커랭크] 2D Array - DS #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 27. 21:55
해커랭크 2D Array - DS 코드 내용(본문2) import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution { // Complete the hourglassSum function below. static int hourglassSum(int[][] arr) { int[] dx = {-1,0,1,-1,0,1}; int[] dy = {-1,-1,-1,1,1,1}; int max = Integer.MIN_VALUE; for(int i=1 ; i..
-
[백준] 1406 에디터 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 24. 21:51
BAEKJOON [1406] 에디터 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.ListIterator; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Bu..
-
[백준] 18258 큐2 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 24. 14:18
BAEKJOON [18258] 큐2 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.LinkedList; import java.util.Queue; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { Queue que = new LinkedList(); BufferedReader bf = new Buffer..
-
[백준] 1919 애너그램 만들기 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 15. 17:31
[백준] 1919 애너그램 만들기 #JAVA BAEKJOON [1919] 애너그램 만들기 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class Main { public static void main(String[] args) throws IOException { int[] alphabet = new int[26]; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char[] first = br.readLine().toCharArray();..
-
[백준] 11328 Strfry #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 15. 14:36
BAEKJOON [11328] Strfry 코드 import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWri..
-
[백준] 1182 부분수열의 합 #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 15. 00:45
BAEKJOON [1182] 부분수열의 합 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int n,s,count; static int[] arr; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] input = br.readLine().split(" "); n = Integer.parseInt(input[0]); s = Integ..
-
[백준] 9663 N-Queen #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 14. 22:42
BAEKJOON [9663] N-Queen 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static int n; static int count = 0; static boolean[] isUsed1;// 행이 사용 되었는지 판단 static boolean[] isUsed2;// 좌측하단에서 우측상단 방향으로 대각선 사용유무 판단 static boolean[] isUsed3;// 우측하단에서 좌측상단 방향으로 대각선 사용유무 판단 public static void main(String[] args) throws NumberFormatExceptio..
-
[백준] 15649 N과 M (1) #JAVAAlgorithm Solving/BAEKJOON 2021. 1. 10. 18:46
BAEKJOON [15649] N과 M (1) 코드 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int n,m; static int[] arr; static boolean[] isused; static StringBuilder sb; public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Strin..