This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| int N, C = sc.nextInt(); | |
| for(int i=0; i<C; i++){ | |
| N = sc.nextInt(); | |
| double[] students = new double[N]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| static int count = 0, N; | |
| static int[] queen; | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| N = sc.nextInt(); sc.close(); | |
| queen = new int[N]; | |
| nqueen(queen, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| int N, C = sc.nextInt(); | |
| for(int i=0; i<C; i++){ | |
| N = sc.nextInt(); | |
| double[] students = new double[N]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| class Solution { | |
| public int solution(int[] pri, int locat) { | |
| ArrayList<int[]> list = new ArrayList<>(); | |
| int count = 0; | |
| for(int i=0; i<pri.length; i++) | |
| list.add(new int[] {i, pri[i]}); // μΈλ±μ€μ μ€μλ μ½μ | |
| while(!list.isEmpty()){ | |
| boolean print = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| class Solution { | |
| public int[] solution(int[] answers) { | |
| int[][] person = {{1, 2, 3, 4, 5}, | |
| {2, 1, 2, 3, 2, 4, 2, 5}, | |
| {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}}; | |
| int[] count = {0, 0, 0}; // κ°κ° a, b, cμ λ§μ κ°μ | |
| for (int i=0; i<person.length; i++){ // μ¬λ μλ§νΌ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Solution { | |
| static int[] arr; | |
| static int tar, count=0; | |
| public int solution(int[] numbers, int target) { | |
| arr = numbers; tar = target; | |
| dfs(0); | |
| return count; | |
| } | |
| static void dfs(int d){ | |
| if (d == arr.length) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| LinkedList<Integer> queue = new LinkedList<>(); | |
| Scanner sc = new Scanner(System.in); | |
| int N = sc.nextInt(); | |
| for(int i=1; i<=N; i++) | |
| queue.add(i); | |
| while (queue.size()!=1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| while (true) { | |
| String a = sc.nextLine(); | |
| if(a.equals(".")) break; // .μ μ’ λ£ | |
| String[] input = a.split(""); // μ λ ₯κ°λ€ μͺΌκ°μ λ£κΈ° | |
| Stack<String> stack = new Stack<>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| static long[] memo = new long[91]; | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| System.out.print(fibo(sc.nextInt())); | |
| } | |
| static long fibo(int n){ | |
| if (n<=1) return n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner sc = new Scanner(System.in); | |
| int [][] memo = new int[41][2]; // κ° μ«μκ° 0κ³Ό 1μ΄ λͺ λ²μ© λμ€λμ§ | |
| memo[0][0]=1; memo[1][1]=1; // [0][1], [1][0]μ 0μΌλ‘ μλμ΄κΈ°ν λ©λλ€. | |
| int t = sc.nextInt(); | |
| for(int i=2; i<41; i++) | |
| for(int j=0; j<2; j++) |