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.math.BigInteger; | |
| import java.util.*; | |
| class Solution { | |
| public static int gcd(int a, int b){ | |
| BigInteger b1 = BigInteger.valueOf(a); | |
| BigInteger b2 = BigInteger.valueOf(b); | |
| return b1.gcd(b2).intValue(); | |
| } | |
| public long solution(int w,int h) { |
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 bridge_length, int weight, int[] truck_weights) { | |
| int answer = 1; // κ²½κ³Όμκ° 1λΆν° | |
| ArrayList<Integer> truck = new ArrayList<>(); // λκΈ° νΈλ | |
| ArrayList<int[]> onBridge = new ArrayList<>(); // λ€λ¦¬λ₯Ό 건λλ νΈλ, νΈλλΉ κ±Έλ¦¬λ μκ° | |
| for (int i : truck_weights) truck.add(i); // νΈλ 무κ²λ₯Ό λκΈ° νΈλ 리μ€νΈμ λ£κΈ° | |
| onBridge.add(new int[]{truck.get(0), bridge_length}); truck.remove(0); // 첫 λ²μ§Έ νΈλμ΄ λ€λ¦¬μ λ€μ΄μκ³ μμ | |
| while(!onBridge.isEmpty()){ // λ€λ¦¬μμ νΈλμ΄ μμ λκΉμ§ | |
| if(onBridge.get(0)[1]==1) // λ€λ¦¬μ μλ κ°μ₯ λ¨Όμ λ€μ΄κ° νΈλμ΄ λ¨μ κ±°λ¦¬κ° 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.*; | |
| /** | |
| * Solution | |
| */ | |
| public class Solution { | |
| public static void main(String[] args) { | |
| int bridge_length = 2; | |
| int weight = 10; | |
| int[] truck_weights = {7, 4, 5, 6}; | |
| System.out.print(solution(bridge_length, weight, truck_weights)); |
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 = sc.nextInt(); | |
| sc.close(); | |
| int i=2; | |
| while (N!=1) { | |
| if(N%i==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.math.BigInteger; | |
| import java.util.*; | |
| public class Main { | |
| public static void main(String args[]) { | |
| Scanner sc = new Scanner(System.in); | |
| BigInteger a = new BigInteger(sc.next()); | |
| BigInteger b = new BigInteger(sc.next()); | |
| sc.close(); | |
| System.out.println(a.gcd(b)); |
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.math.BigInteger; | |
| import java.util.*; | |
| public class Main { | |
| public static void main(String args[]) { | |
| Scanner sc = new Scanner(System.in); | |
| int N = sc.nextInt(); | |
| BigInteger firstRing = new BigInteger(sc.next()); // 첫 λ²μ§Έ λ§ | |
| BigInteger[] num = new BigInteger[N-1]; | |
| for (int i=0; i<N-1; 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
| import java.util.*; | |
| public class Main { | |
| public static void main(String args[]) { | |
| Scanner sc = new Scanner(System.in); | |
| int N = sc.nextInt(); | |
| sc.close(); | |
| int i=0; | |
| int newNum = N; | |
| if(N<10){ // Nμ΄ 10λ³΄λ€ μλ€λ©΄ |
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 = sc.nextInt(); | |
| int[] realDivisor = new int[N]; | |
| for(int i=0; i<N; i++) | |
| realDivisor[i] = sc.nextInt(); | |
| sc.close(); Arrays.sort(realDivisor); |
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 = sc.nextInt(); | |
| double []num = new double[N]; | |
| for(int i=0; i<N; i++) num[i]=sc.nextDouble(); | |
| sc.close(); | |
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
| #include <stdio.h> | |
| #include <string.h> | |
| int queue[2000001]; | |
| int front=0; | |
| int rear=-1; | |
| void clean(char arr[]); // μ΄κΈ°νμ© ν¨μ | |
| void push(int x); | |
| void pop(void); |