[백준] 2775번 부녀회장이 될테야 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); StringBuilder sb = new StringBuilder(); int num = kb.nextInt(); int[][] arr = new int [15][15]; for(int i=1; i 공부기록/백준 2023.09.27
[백준] 1110번 더하기 사이클 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int num = kb.nextInt(); int originalNum = num; int count = 0; do { int tensDigit = num / 10; int onesDigit = num % 10; int sum = tensDigit + onesDigit; num = (onesDigit * 10) + (sum % 10); count++; } while (num != originalNum); System.out.print(count); } } 공부기록/백준 2023.09.27
[백준] 4963번 섬의 개수 import java.util.Scanner; public class Main { static int w, h; static int[][] a; static boolean[][] visit; static int[][] dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}}; static int count; static void DFS(int x, int y) { visit[x][y] = true; for (int i = 0; i = h || ny >= w) contin.. 공부기록/백준 2023.09.24
[백준] 2667번 단지번호붙이기 import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { static String[] a; static int n; static boolean[][] visit; static ArrayList group; static int groupCount; static int[][] dir = {{-1,0},{1,0},{0,-1},{0,1}}; static void DFS(int x, int y) { groupCount++; visit[x][y] = true; for(int i=0; i 공부기록/백준 2023.09.24
[백준] 1260번 DFS와 BFS import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; public class Main { static ArrayList[] adj; static boolean[] visit; static StringBuilder sb = new StringBuilder(); static void dfs(int x) { visit[x] = true; sb.append(x).append(' '); for(int y: adj[x]) { if(visit[y]) continue; dfs(y); } } static void bfs(int x).. 공부기록/백준 2023.09.23
[백준] 1076번 저항 import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); String color1 = kb.next(); String color2 = kb.next(); String color3 = kb.next(); ArrayList list = new ArrayList(); list.add("black"); list.add("brown"); list.add("red"); list.add("orange"); list.add("yellow"); list.add("green"); list.add("blue");.. 공부기록/백준 2023.09.22
[백준] 11720번 숫자의 합 구하기 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int n = kb.nextInt(); String s = kb.next(); int sum =0; for(char x: s.toCharArray()) { sum+= x-'0'; } System.out.println(sum); } } 공부기록/백준 2023.08.30
[백준] 5524번 입실관리 5524번 입실관리 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); for(int i=0; i 공부기록/백준 2023.06.06
[백준] 1676번 팩토리얼 0의 개수, 27866번 문자와 문자열 1676번 팩토리얼 0의 개수 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); int a = num/5; int b = num/25; int c = num/125; System.out.println(a+b+c); } } 팩토리얼이라고 팩토리얼을 구현할 필요가 없었던 문제 복잡하게 생각하지 말자 27866번 문자와 문자열 import java.util.Scanner; public class Main { public static void main(String[] args) { .. 공부기록/백준 2023.05.31
[백준] 2439번 별찍기 -2 2439번 별찍기-2 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int j; for(int i=0; i< n; i++) { for(j=n-1; i 공부기록/백준 2023.02.25