알고리즘&자료구조/백트랙킹(2)
-
백트랙킹- N-QUEEN(백준 9663번)
1. 백트래킹을 이용한 N-QUEEN 문제 (백준 9663번) 2.백트랙킹을 이용한 풀이 123456789101112131415161718192021222324252627282930313233343536373839package recursiveandbacktracking;import java.util.Scanner; public class Baekjun9663BacktrackingNQueen { static int[] iArr; static int count; static int N; //퀸이 놓일수 있는가? static boolean promising(int[] iArr,int N,int row) { for(int i=0;i
2018.03.16 -
백트랙킹-로또문제(백준 6603번)
1.백트랙킹- 로또문제(백준6603번) 2. 백트랙킹을 이용한 풀이1234567891011121314151617181920212223242526272829303132333435363738394041package recursiveandbacktracking; import java.util.Arrays;import java.util.Scanner; public class Baekjun6603BacktrackingLotto { static int K; static int[] iArr; static int count; static StringBuffer sb=new StringBuffer(); static void dfsForRecursive(int v,String str) { if(count==6) { sb...
2018.03.16