목록문제 (388)
sm 기술 블로그
import java.util.*; import java.io.*; class Main { static int[][] paper; static ArrayList result; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); paper = new int[N][N]; result = new ArrayList(); for (int i = 0; i < N; i++) { String[] tmp = br.readLine().split(""); for (i..
import sys input = sys.stdin.readline N = int(input()) paper = [list(map(int, input().rstrip())) for _ in range(N)] result = [] def find(x, y, N): color = paper[x][y] for i in range(x, x+N): for j in range(y, y+N): if color != paper[i][j]: result.append(str("(")) find(x, y, N//2) find(x, y+N//2, N//2) find(x+N//2, y, N//2) find(x+N//2, y+N//2, N//2) result.append(str(")")) return if color == 0: ..
import java.util.*; import java.io.*; class Main { static int[][] paper; static int cnt0; static int cnt1; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); paper = new int[N][N]; cnt0 = 0; cnt1 = 0; for (int i = 0; i < N; i++) { String[] tmp = br.readLine().split(" "); fo..
import sys input = sys.stdin.readline N = int(input()) paper = [list(map(int, input().split())) for _ in range(N)] result = [] def find(x, y, N): color = paper[x][y] for i in range(x, x+N): for j in range(y, y+N): if color != paper[i][j]: find(x, y, N//2) find(x, y+N//2, N//2) find(x+N//2, y, N//2) find(x+N//2, y+N//2, N//2) return if color == 0: result.append(0) else: result.append(1) find(0, 0..