목록시뮬레이션 (15)
-
# 주소 https://www.acmicpc.net/problem/1592 1592번: 영식이와 친구들 예제 1의 경우 일단 1번이 공을 잡는다. 1번은 공을 한 번 잡았기 때문에, 공을 3번에게 던진다. 3번은 공을 한 번 잡았기 때문에, 공을 5번에게 던진다. 5번은 2번에게 던지고, 2번은 4번에게 던진다 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int l = scan.nextIn..
# 주소 https://www.acmicpc.net/problem/19236 19236번: 청소년 상어 첫째 줄부터 4개의 줄에 각 칸의 들어있는 물고기의 정보가 1번 행부터 순서대로 주어진다. 물고기의 정보는 두 정수 ai, bi로 이루어져 있고, ai는 물고기의 번호, bi는 방향을 의미한다. 방향 bi는 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Fish{ int num; int x; int y; int dir; int alive; Fish(int num, int x, int y, int dir, int alive){ this.num = num; this.x = x; this.y = y; this.dir = dir; this.al..
# 주소 https://www.acmicpc.net/problem/14719 14719번: 빗물 첫 번째 줄에는 2차원 세계의 세로 길이 H과 2차원 세계의 가로 길이 W가 주어진다. (1 ≤ H, W ≤ 500) 두 번째 줄에는 블록이 쌓인 높이를 의미하는 0이상 H이하의 정수가 2차원 세계의 맨 왼쪽 위치 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Main{ static int n, m; static int[][] arr; public static void main(String[] args) { Scanner scan = new Scanner(System.in); n = scan.nextInt(); m = scan.nextInt()..
# 주소 https://www.acmicpc.net/problem/2636 2636번: 치즈 아래 과 같이 정사각형 칸들로 이루어진 사각형 모양의 판이 있고, 그 위에 얇은 치즈(회색으로 표시된 부분)가 놓여 있다. 판의 가장자리(에서 네모 칸에 X친 부분)에는 치즈가 놓 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.awt.*; import java.util.*; class Main{ static int[][] arr; static boolean[][] visit; static int n, m; static int answer = 0; static int[][] dir = {{-1, 0}, {1, 0}, {0, 1}, {0, -1}}; static Queue q..
# 주소 https://www.acmicpc.net/problem/16236 # 문제 # 문제 해설 및 코드 리뷰 package com.core.hello; import java.util.*; class Point{ int x; int y; int cnt; Point(int x, int y, int cnt){ this.x = x; this.y = y; this.cnt = cnt; } } class Main{ static int n; static int SIZE = 2; static int cnt = 0; static int answer = 0; static boolean[][] visit; static int[][] arr; static int[][] map; static Queue queue = new..
# 주소 https://www.acmicpc.net/problem/17779 17779번: 게리맨더링 2 재현시의 시장 구재현은 지난 몇 년간 게리맨더링을 통해서 자신의 당에게 유리하게 선거구를 획정했다. 견제할 권력이 없어진 구재현은 권력을 매우 부당하게 행사했고, 심지어는 시의 이름 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Main{ static int n; static int[][] arr; static int min = Integer.MAX_VALUE; public static void main(String[] args) { Scanner scan = new Scanner(System.in); n = scan.nextInt()..