목록백트레킹 (2)
변수의 기록

내가 제출한 답 package test;import java.util.*;import java.io.*;public class testest { static int n, s, result = 0; static int[] list; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); ..
기타/코딩테스트
2025. 5. 16. 10:16

해결한 답.import java.util.*;public class Main { static int N; static int count = 0; static boolean[] col; // 열 체크 static boolean[] diag1; // ↙ 대각선 (row + col) static boolean[] diag2; // ↘ 대각선 (row - col + N - 1) public static void main(String[] args) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); // 예: 8 입력 시 8-Queen 문제 col = new boolean[N..
기타/코딩테스트
2025. 5. 12. 16:23