코딩테스트

    톱니바퀴 - 14891번

    톱니바퀴 - 14891번

    내 코드 package com.company; 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)); StringTokenizer st = null; int answer = 0; int[] check = new int[4]; // 각 톱니바퀴 회전 방향 LinkedList[] lists = new LinkedList[4]; // 톱니바퀴 for (int i = 0; i < 4; i++) { String s = br.rea..

    인구 이동 - 16234번

    인구 이동 - 16234번

    내 코드 package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; static int[][] arr; static int R, L, N, count; static int[][] visited; static int[] ck; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokeni..

    녹색 옷 입은 애가 젤다지? - 4485번

    녹색 옷 입은 애가 젤다지? - 4485번

    package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; StringBuilder sb = new StringBuilder(); int N = 0; int T = 1; while ((N = Integer.parseInt(br.readLine(..

    달이 차오른다, 가자. - 1194번

    달이 차오른다, 가자. - 1194번

    package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nex..

    백조의 호수 - 3197번

    백조의 호수 - 3197번

    내 코드 package com.company; 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)); StringTokenizer st = new StringTokenizer(br.readLine()); int R = Integer.parseInt(st.nextToken()); int C = Integer.parseInt(st.nex..

    경사로 - 14890번

    경사로 - 14890번

    내 코드 package com.company; 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)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int L = Integer.parseInt(st.nextToken()); int[][] arr = new int[N + 1][N + 1]; in..

    가운데를 말해요 - 1655

    가운데를 말해요 - 1655

    내 코드 package com.company; 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)); StringBuilder sb = new StringBuilder(); int N = Integer.parseInt(br.readLine()); PriorityQueue pqRight = new PriorityQueue(); // 중간보다 큰쪽(오른쪽) PriorityQueue pqLeft = new PriorityQue..

    주사위 굴리기 - 14499번

    주사위 굴리기 - 14499번

    내 코드 package com.company; import java.io.*; import java.util.*; public class Main { static int[][] d = {{0}, {0, 1}, {0, -1}, {-1, 0}, {1, 0}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parse..

    나머지 합 - 10986번

    나머지 합 - 10986번

    내 코드 package com.company; 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)); StringTokenizer st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken()); int M = Integer.parseInt(st.nextToken()); int[] sum = new int[N + 1]; int[] count..

    로봇 - 1726번

    로봇 - 1726번

    내 코드 package com.company; import java.io.*; import java.util.*; public class Main { // 방향 : 아래, 왼쪽, 위, 오른쪽 static int[][] d = {{1, 0}, {0, -1}, {-1, 0}, {0, 1}}; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int M = Integer.parseInt(st.nextToken()); int..