diff --git "a/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/N-Queen.java" "b/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/N-Queen.java" new file mode 100644 index 0000000..0ea2552 --- /dev/null +++ "b/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/N-Queen.java" @@ -0,0 +1,43 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class BOJ_9663 { + static boolean[] isUsed1 = new boolean[40]; + static boolean[] isUsed2 = new boolean[40]; + static boolean[] isUsed3 = new boolean[40]; + + static int count = 0; + static int n; + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + n = Integer.parseInt(br.readLine()); + + backTracking(0); + + System.out.println(count); + } + + public static void backTracking(int cur) + { + if(cur==n){ + count++; + return; + } + + for(int i=0; i0?arr[k-1]+1:1); i<=n; i++) + { + if(isUsed[i]) continue; + + arr[k]=i; + isUsed[i]=true; + + backTracking(k+1); + isUsed[i] = false; + } + } +} diff --git "a/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/Z.java" "b/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/Z.java" new file mode 100644 index 0000000..8648e22 --- /dev/null +++ "b/0x0B_0x0C/\352\271\200\354\232\260\354\240\225/Z.java" @@ -0,0 +1,37 @@ +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.StringTokenizer; + +public class BOJ_1074 { + 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 r = Integer.parseInt(st.nextToken()); + int c = Integer.parseInt(st.nextToken()); + + int result = z(r, c, n); + + System.out.println(result); + + br.close(); + } + + public static int z(int r, int c, int n){ + if(n==0) + return 0; + + int half = 1<=half) + return half*half + z(r, c-half, n-1); + else if(r>=half && c