본문 바로가기

코딩테스트(백준)

(46)
[백준] 14891 : 톱니바퀴 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/14891 14891번: 톱니바퀴 첫째 줄에 1번 톱니바퀴의 상태, 둘째 줄에 2번 톱니바퀴의 상태, 셋째 줄에 3번 톱니바퀴의 상태, 넷째 줄에 4번 톱니바퀴의 상태가 주어진다. 상태는 8개의 정수로 이루어져 있고, 12시방향부터 � www.acmicpc.net import java.util.Arrays; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; class topni { int topnum; int dir; topni(int topnum, int dir) { this.topnum = topnum; this.dir = dir; } } public c..
[백준] 15686 : 치킨 배달 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/15686 15686번: 치킨 배달 크기가 N×N인 도시가 있다. 도시는 1×1크기의 칸으로 나누어져 있다. 도시의 각 칸은 빈 칸, 치킨집, 집 중 하나이다. 도시의 칸은 (r, c)와 같은 형태로 나타내고, r행 c열 또는 위에서부터 r번째 칸 www.acmicpc.net import java.util.ArrayList; import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; class chicken{ int x; int y; int ct; chicken(int x, int y, int ct){ this.x=x; this.y=y; this.ct=ct; } } ..
[백준] 14502 : 연구소 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/14502 import java.util.ArrayList; import java.util.Scanner; public class Main { static int N; static int M; static int[][]arr; static int[][]temp; static ArrayList list; static int maxnum; static int[]dx= {-1,0,1,0}; static int[]dy= {0,1,0,-1}; static boolean[][] visited; static int[][]temparr; static int MAX; public static void main(String[] args) { Scanner sc = ..
[백준] 16236 : 아기 상어 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/16236 16236번: 아기 상어 N×N 크기의 공간에 물고기 M마리와 아기 상어 1마리가 있다. 공간은 1×1 크기의 정사각형 칸으로 나누어져 있다. 한 칸에는 물고기가 최대 1마리 존재한다. 아기 상어와 물고기는 모두 크기를 가�� www.acmicpc.net import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; class shark{ int x; int y; int time; shark(int x, int y, int time){ this.x=x; this.y=y; this.time=time; } } public class Main { static int..
[백준] 14889 : 스타트와 링크 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/14889 14889번: 스타트와 링크 예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다. www.acmicpc.net public class Main { static int[][] arr; static ArrayList list; static int size; static int MIN; public static void main(String[] args) { Scanner sc = new Scanner(System.in); size = sc.nextInt(); arr = new int[size + 1][size + 1]; MIN=I..
[백준] 17144: 미세먼지 안녕! - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/17144 17144번: 미세먼지 안녕! 미세먼지를 제거하기 위해 구사과는 공기청정기를 설치하려고 한다. 공기청정기의 성능을 테스트하기 위해 구사과는 집을 크기가 R×C인 격자판으로 나타냈고, 1×1 크기의 칸으로 나눴다. 구사 www.acmicpc.net import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; class robot{ int x; int y; int dir; robot(int x, int y, int dir){ this.x=x; this.y=y; this.dir=dir; } } public class Main { static int N; stati..
[백준] 14503 : 로봇 청소기 - JAVA(자바) - 사좋배 공유 https://www.acmicpc.net/problem/14503 import java.util.LinkedList; import java.util.Queue; import java.util.Scanner; class robot{ int x; int y; int dir; robot(int x, int y, int dir){ this.x=x; this.y=y; this.dir=dir; } } public class Main { static int N; static int M; static int[][]arr; static int[]dx= {-1,0,1,0}; static int[]dy= {0,1,0,-1}; static int count; static Queue q; public static void m..
[백준] 15683 : 감시 - JAVA(자바) - 사좋배 공유 import java.util.ArrayList; import java.util.Scanner; class node{ int x; int y; int number; node(int x, int y, int number){ this.x=x; this.y=y; this.number=number; } } public class Main { static int [][]arr; static int [][]temparr; static ArrayListlist; static ArrayListlist2; static int cnt; static int N; static int M; static int MIN; public static void main(String[] args) { Scanner sc= new Scan..