전체 글

일상, 개발 공부
백준 4673 셀프 넘버 package Baekjoon; public class B4673 { public static void main(String[] args) { // TODO Auto-generated method stub boolean[] check = new boolean[10001]; for (int i = 1; i
백준 9095 1,2,3 더하기 package Baekjoon; import java.util.Scanner; public class B9095 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int dp[] = new int [11]; int c = sc.nextInt(); dp[1] = 1; dp[2] = 2; dp[3] = 4; for (int j = 4; j
백준 2577 숫자의 개수 import java.util.Scanner; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int n = (sc.nextInt() * sc.nextInt() * sc.nextInt()); String str = Integer.toString(n); for (int i = 0; i < 10; i++) { int count = 0; for (int j = 0; j < str.length(); j++) { if ((str.charAt(j) - '0') == i) { count++; } } Sy..
백준 3052 나머지 후에 중복을 허용하지 않는 HashSet을 사용하여 재풀이 할 것. package Baekjoon; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class B3052 { //HashSet(중복허용 X)로 바꿀것!! public static void main(String[] args) throws IOException { // TODO Auto-generated method stub BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int[] arr = new int[10..
백준 27433 팩토리얼 n! 재귀함수 package Baekjoon; import java.util.Scanner; public class B27433 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); Long n = sc.nextLong(); System.out.println(factorial(n)); } public static Long factorial(Long n) { if (n == 0 || n == 1) return 1L; else return n * factorial(n - 1); } } 백준 10870 피보나치 0과 1에 주의할 것 p..
백준 1463 1로 만들기 package Baekjoon; import java.util.Scanner; public class B1463 { static Integer[] a; public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int N = in.nextInt(); a = new Integer[N + 1]; a[0] = a[1] = 0; System.out.print(recur(N)); } static int recur(int N) { if (a[N] == null) { // 6으로 나눠지는 경우 if (N % 6 == 0) { a[N] = Math.m..
백준 23971 ZOAC 4 package Baekjoon; import java.util.Scanner; public class B23971 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); int N = sc.nextInt(); int M = sc.nextInt(); int height = (H-1)/(N+1)+1; int width = (W-1)/(M+1)+1; System.out.println(height*width); } } 먼저 수직적으로 계산했을때 (1,1)는 ..
TIL 재개 백준 1934 최소공배수 package Baekjoon; import java.util.Scanner; public class B1934 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int N = in.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < N; i++) { int a = in.nextInt(); int b = in.nextInt(); int d = gcd(a, b); sb.append(a * b / d).append('\n'); } System...
붕어빵또아
붕어빵또아