We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main.java.com.poogle.BOJ.Q1780; import java.util.Scanner; public class Main { static int n; static int[][] board = new int[2200][2200]; static int[] cnt = new int[3]; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { board[i][j] = sc.nextInt(); } } calculate(0, 0, n); for (int i : cnt) { System.out.println(i); } } private static void calculate(int x, int y, int z) { if (check(x, y, z)) { cnt[board[x][y] + 1] += 1; return; } int n = z / 3; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { calculate(x + i * n, y + j * n, n); } } } private static boolean check(int x, int y, int n) { for (int i = x; i < x + n; i++) { for (int j = y; j < y + n; j++) { if (board[i][j] != board[x][y]) return false; } } return true; } }
The text was updated successfully, but these errors were encountered:
9e13b16
suhyunsim
No branches or pull requests
문제
핵심 아이디어
어려운 점, 실수
풀이
The text was updated successfully, but these errors were encountered: