목록백준 문제 풀이 (158)
-
# 주소 https://www.acmicpc.net/problem/16933 16933번: 벽 부수고 이동하기 3 첫째 줄에 N(1 ≤ N ≤ 1,000), M(1 ≤ M ≤ 1,000), K(1 ≤ K ≤ 10)이 주어진다. 다음 N개의 줄에 M개의 숫자로 맵이 주어진다. (1, 1)과 (N, M)은 항상 0이라고 가정하자. www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class B{ int x; int y; int z; int day; int time; B(int x, int y, int z, int day, int time){ this.x = x; this.y = y; this.z = z; this.day = day; this.time = t..
# 주소 https://www.acmicpc.net/problem/21609 21609번: 상어 중학교 상어 중학교의 코딩 동아리에서 게임을 만들었다. 이 게임은 크기가 N×N인 격자에서 진행되고, 초기에 격자의 모든 칸에는 블록이 하나씩 들어있고, 블록은 검은색 블록, 무지개 블록, 일반 블록 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Block{ int x; int y; int sum; int rainbow; boolean[][] v; Block(int x, int y, int rainbow, int sum, boolean[][] v){ this.x = x; this.y = y; this.rainbow = rainbow; this...
# 주소 https://www.acmicpc.net/problem/19237 19237번: 어른 상어 첫 줄에는 N, M, k가 주어진다. (2 ≤ N ≤ 20, 2 ≤ M ≤ N2, 1 ≤ k ≤ 1,000) 그 다음 줄부터 N개의 줄에 걸쳐 격자의 모습이 주어진다. 0은 빈칸이고, 0이 아닌 수 x는 x번 상어가 들어있는 칸을 의미 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Shark{ int x; int y; int dir; int num; Shark(int x, int y, int dir, int num){ this.x = x; this.y = y; this.dir = dir; this.num = num; } } class Ga..
# 주소 https://www.acmicpc.net/problem/20058 20058번: 마법사 상어와 파이어스톰 마법사 상어는 파이어볼과 토네이도를 조합해 파이어스톰을 시전할 수 있다. 오늘은 파이어스톰을 크기가 2N × 2N인 격자로 나누어진 얼음판에서 연습하려고 한다. 위치 (r, c)는 격자의 r행 c www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.awt.*; import java.util.*; class M{ static int n, q; static int size; static int[][] arr; static boolean[][] visit; static ArrayList list = new ArrayList(); static Queue queu..
# 주소 https://www.acmicpc.net/problem/15684 15684번: 사다리 조작 사다리 게임은 N개의 세로선과 M개의 가로선으로 이루어져 있다. 인접한 세로선 사이에는 가로선을 놓을 수 있는데, 각각의 세로선마다 가로선을 놓을 수 있는 위치의 개수는 H이고, 모든 세로선 www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Main{ static int n, m, k; static boolean[][] visit; static int answer; public static void main(String[] args) { answer = 0; Scanner scan = new Scanner(System.in); n = sca..
# 주소 https://www.acmicpc.net/problem/17143 17143번: 낚시왕 낚시왕이 상어 낚시를 하는 곳은 크기가 R×C인 격자판으로 나타낼 수 있다. 격자판의 각 칸은 (r, c)로 나타낼 수 있다. r은 행, c는 열이고, (R, C)는 아래 그림에서 가장 오른쪽 아래에 있는 칸이다. www.acmicpc.net # 문제 # 문제 해설 및 코드 리뷰 import java.util.*; class Fishing{ int x; int y; int speed; int direction; int size; Fishing(int x, int y, int speed, int direction, int size){ this.x = x; this.y = y; this.speed = speed..