Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Last active August 29, 2015 13:57
Show Gist options
  • Save KT-Yeh/9484822 to your computer and use it in GitHub Desktop.
Save KT-Yeh/9484822 to your computer and use it in GitHub Desktop.
void backtracking()
{
if (填完所有空格) {
輸出解答;
return;
}
for (int i = 1; i <= 9; ++i) {
if (i符合規則) {
將i填入空格;
backtracking(); // 遞迴下去填下個空格
將i從空格移除;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment