목록Algorithm/Algorithm 문제 (96)
녕의 학습 기록

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_2023 { static int n; static StringBuilder sb; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); sb = new StringBuilder(); n = Integer.parseInt(br.readLine()); dfs(2,1); dfs(3,1); dfs(5,1); dfs(7,1); System..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.StringTokenizer; public class BJ_11724 { static ArrayList[] arr; static boolean[] visited; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringToke..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_10989 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int i, n; n = Integer.parseInt(br.readLine()); int[] arr = new int[n]; for(i=0; i

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; public class BJ_10989 { public static void main(String[] args) throws IOException { int n, i, k, j, num, ind; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(br.readLine()); Queue resultQ = new LinkedList(..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_1517 { static int[] arr, tempArr; static long result; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); arr = new int[n]; tempArr ..

기존 코드는 분할 할때마다 새로운 int 배열 두개를 생성해서 정렬하고, 그걸 merge한 배열을 또 새로 만들어서 반환하는 형식 에서 다른 코드 참고하고 이해해서 개선했다 해당 코드는 정렬을 위한 temp 배열 외에는 다른 배열을 만들지 않고 정렬한 값을 다시 본 입력받은 배열에 저장하는 방식 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_2751 { static int[] arr, tempArr; public static void main(String[] args) throws IOException { BufferedReader br = new Buffe..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_2751 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(); int[] inputArr = new int[n]; for(int i=0; i

제한시간이 좀 빡세긴 하지만 내용은 기초적인 퀵 정렬 문제이다. 부끄럽지만, 다른 사람 코드를 보고도 5시간을 붙잡고 있었다. 오늘 하루 시간을 다써버렸지만, 안보고 다시 코드 작성해보라고 하면 다시 작성할 수 있을 정도로 이해하기는 했다. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_11004 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStre..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class BJ_11399 { public static void main(String[] args) throws IOException { int n, i, j, index, sortNum, result; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); n = Integer.parseInt(br.readLine());..

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BJ_1427 { public static void main(String[] args) throws IOException { int i, j, maxInd, temp; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String n = br.readLine(); int[] arr = new int[n.length()]; for(i=0; i