Algorithm/BOJ
-
[BOJ - Gold IV] 즐거운 단어 / ❌Algorithm/BOJ 2024. 8. 22. 16:32
즐거운 단어1. 제출 코드 (2시간 32분 46초 / DFS)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class Main { static String input; static long answer = 0; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); input = br.readLine(); dfs(0, 0, 0, false, 1)..
-
[BOJ - Silver III] 먹을 것인가 먹힐 것인가 / ⭕Algorithm/BOJ 2024. 8. 22. 10:57
먹을 것인가 먹힐 것인가1. 제출 코드 (42분 20초 / 이분 탐색)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.Arrays;import java.util.StringTokenizer;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int T = Intege..
-
[BOJ - Silver II] 촌수계산 / ⭕Algorithm/BOJ 2024. 8. 21. 11:04
촌수계산1. 제출 코드 (18분 20초 / BFS)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayDeque;import java.util.StringTokenizer;public class Main { static int N; static int[][] relation; static boolean[][] visited; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStrea..
-
[BOJ - Silver V] 피카츄 / ❌Algorithm/BOJ 2024. 8. 21. 10:31
피카츄1. 제출 코드 (23분 23초 / 문자열)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;public class BOJ_14405 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); input = input.replaceAll("pi|ka|chu", ""); System.out.println..
-
[BOJ - Silver V] 그룹 단어 체커 / ⭕Algorithm/BOJ 2024. 8. 20. 22:50
그룹 단어 체커1. 제출 코드 (12분 23초 / 구현)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.HashMap;import java.util.Map;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); int answer =..
-
[BOJ - Silver II] 생태학 / ⭕Algorithm/BOJ 2024. 8. 19. 20:55
생태학 1. 제출 코드 (15분 21초 / 자료구조(Map))import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Map map = new HashMap(); String input; int cnt = 0; while(sc.hasNext()) { input = sc.nextLine(); map.put(input, map.getOrDefault(input, 0) + 1); cnt++; } List key..
-
[BOJ - Gold IV] 녹색 옷 입은 애가 젤다지? / ⭕Algorithm/BOJ 2024. 8. 19. 16:52
녹색 옷 입은 애가 젤다지?1. 제출 코드 (39분 29초 / BFS)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayDeque;import java.util.Arrays;import java.util.PriorityQueue;import java.util.StringTokenizer;public class BOJ_4485 { static int[] dx = {-1, 1, 0, 0}; static int[] dy = {0, 0, -1, 1}; static int N; public static void main(String[] args..
-
[BOJ - Gold IV] 운동 / ⭕Algorithm/BOJ 2024. 8. 19. 14:34
운동1. 제출 코드 (24분 00초 / 플로이드 워셜)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int V = In..