[백준] 2012번 등수 매기기 import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] arr = new int[n+1]; for(int i=1; i 공부기록/백준 2024.02.07
[백준] 10716번 숫자 카드 2 import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int N = kb.nextInt(); HashMap map = new HashMap(); for(int i= 0; i 공부기록/백준 2024.02.07
[백준] 1010번 다리 놓기 import java.util.Scanner; public class Main { static long[][] arr; static long combination(int m, int n) { if(arr[m][n] != 0) { return arr[m][n]; } if(m ==n || n == 0) { return 1; } arr[m][n] = combination(m-1, n-1) + combination(m-1, n); return arr[m][n]; } public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int T = kb.nextInt();.. 공부기록/백준 2024.02.07
[백준] 16953번 A → B import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String a = kb.next(); String b = kb.next(); int count = 1; while(!a.equals(b)) { if(Integer.parseInt(a)>Integer.parseInt(b)) { break; } char last = b.charAt(b.length()-1); if(last == '1') { b = b.substring(0, b.length()-1); count++; }else if(Integer.parseInt(b)%2 ==0) { int.. 공부기록/백준 2024.02.05
[백준] 1439번 뒤집기 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String s = kb.next(); String check = ""; check += s.charAt(0); for(int i=1; i 공부기록/백준 2024.02.05
[백준] 1541번 잃어버린 괄호 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String s = kb.next(); String[] nums = s.split("-"); int[] sum = new int[nums.length]; for(int i=0; i 공부기록/백준 2024.02.05
[백준] 12931번 두 배 더하기 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); int[] B = new int[n]; int sum = 0; int count = 0; for(int i=0; i 공부기록/백준 2024.02.05
[백준] 12871번 무한 문자열 import java.util.Scanner; public class Main { static int gcd(int a, int b) { if(b==0) { return a; } return gcd(b, a%b); } public static void main(String[] args){ Scanner kb = new Scanner(System.in); String s = kb.next(); String t = kb.next(); int gcd = gcd(s.length(), t.length()); String fs = s.repeat(t.length()/gcd); String ft = t.repeat(s.length()/gcd); if(fs.equals(ft)) { System.out.println(1.. 공부기록/백준 2024.02.04
[백준] 14490번 백대열 import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner kb = new Scanner(System.in); String question = kb.next(); String[] nums = question.split(":"); BigInteger[] bigIntegerNums = new BigInteger[2]; for(int i=0; i 공부기록/백준 2024.02.04
[백준] 11399번 ATM import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int N = kb.nextInt(); int[] persons = new int[N]; for(int i=0; i 공부기록/백준 2024.02.04