문제https://www.acmicpc.net/problem/30804코드import java.io.*;import java.util.*;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[] fruits = new int[N]; StringTokenizer st = new StringTokenizer(br.readLine()); for ..
문제https://www.acmicpc.net/problem/7569 코드import java.io.*;import java.util.*;public class Main { private static int[][][] tomato; private static int[] dx = { -1, 1, 0, 0, 0, 0 }; private static int[] dy = { 0, 0, -1, 1, 0, 0 }; private static int[] dz = { 0, 0, 0, 0, -1, 1 }; private static int M; private static int N; private static int H; private static Queue queue = n..
문제https://www.acmicpc.net/problem/28702코드import java.io.*;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int answer = -1; for (int i = 0; i 풀이예제를 보자마자 떠오른 가장 이상적인 경우는, 연속으로 출력된 세 문자열 중에 적어도 한 개는 숫자 그대로(`i`) 출력되는 것이었다. 즉, 3의 배수도 아니고 5의 배수도 아닌 숫자가 반드시 끼어있어야 했다. 그래서 생각해..
문제https://www.acmicpc.net/problem/15829코드import java.io.*;public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int L = Integer.parseInt(br.readLine()); int r = 31; int M = 1234567891; String line = br.readLine(); long result = 0; long pow = 1; ..
문제https://www.acmicpc.net/problem/2667코드import java.io.*;import java.util.*;public class Main { private static int[][] map; private static boolean[][] visited; private static int N; private static int[] dx = {-1, 1, 0, 0}; private static int[] dy = {0, 0, 1, -1}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputS..
문제https://www.acmicpc.net/problem/7568코드import java.io.*;import java.util.*;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()); Person[] people = new Person[N]; for (int i = 0; i 0) { rank++; ..