This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void backtracking() | |
{ | |
if (填完所有空格) { | |
輸出解答; | |
return; | |
} | |
for (int i = 1; i <= 9; ++i) { | |
if (i符合規則) { | |
將i填入空格; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void backtracking (int N, int Len) | |
{ | |
if (Len == N) { | |
輸出答案; | |
return; | |
} | |
for (可能的數字) { | |
if (這數字符合) | |
backtracking(N, Len + 1); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
using namespace std; | |
string str; | |
string Ans; // 過程中保存答案用 | |
bool choosed[100] = {0}; // choosed[i]==1表示編號i已經出現過 | |
void backtracking(const int &N); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
vector<int> toNxt[30]; // toNxt[i]裡面存i這個點在哪些點前面 | |
int deg[30]; // deg[i]表示在i前面有多少個點 | |
vector<int> Ans; | |
void Initial(int N) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
int N; | |
vector<int> children[101]; | |
int numOfElder[101]; | |
int visit[101]; | |
vector<int> Ans; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <sstream> | |
#include <algorithm> | |
using namespace std; | |
int Input(char []); | |
void Input2(char [], vector<int> [], int []); | |
bool backtracking(int, int, vector<int> [], int [], vector<int> &, char []); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <cstdio> | |
using namespace std; | |
void DFS(int i, int j, char board[][4],string &Word, vector<string> &PigEwu); | |
int NumOfVowel(string &a); | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
int M, N, K; | |
vector<int> toNxt[105]; | |
int color[105]; // Black is 1, White is 2 | |
int MaxNum; | |
vector<int> Container, Ans; | |
void Initial(int N); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
using namespace std; | |
int N, M; | |
int i1, i2, d1, d2, p[20], q[20]; | |
int choosed[20]; | |
bool backtracking(int Len, int num) | |
{ | |
if (Len == N) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <vector> | |
using namespace std; | |
vector<int> toNxt[6] = {{}, {2,3,5}, {1,3,5}, {1,2,4,5}, {3,5}, {1,2,3,4}}; | |
bool choosed[6][6] = {0}; | |
int ans[9]; | |
void func(int n, int Len) | |
{ |