분류 전체보기
-
[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..
-
[BOJ - Gold IV] 곡예 비행 / ⭕Algorithm/BOJ 2024. 8. 18. 19:03
곡예 비행 1. 제출코드 (3시간 32분 43초 / DP)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, M; static int[][] map; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); S..
-
[BOJ - Gold V] 토마토 / ⭕Algorithm/BOJ 2024. 8. 17. 15:46
토마토1. 제출 코드 (31분 26초 / BFS)import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.ArrayDeque;import java.util.ArrayList;import java.util.StringTokenizer;public class Main { static class Pos { int x, y; public Pos(int x, int y) { this.x = x; this.y = y; } } static int N, M; static int[][] to..