Unverified Commit f9be92f3 authored by ir1d's avatar ir1d Committed by GitHub
Browse files

Update backtracking.md (#1345)

Update backtracking.md
parents afc991a1 710546d6
Loading
Loading
Loading
Loading
+72 −68
Original line number Diff line number Diff line
@@ -42,9 +42,13 @@ void eq(int line)
		if((!check[0][i]) && (!check[1][line + i]) && (!check[2][line - i + n]))
		{
			ans[line] = i;
            check[0][i]=1; check[1][line+i]=1; check[2][line-i+n]=1;
			check[0][i] = 1;
			check[1][line + i] = 1;
			check[2][line - i + n] = 1;
			eq(line + 1);
            check[0][i]=0; check[1][line+i]=0; check[2][line-i+n]=0;
			check[0][i] = 0;
			check[1][line + i] = 0;
			check[2][line - i + n] = 0;
		}
	}
}
@@ -66,7 +70,8 @@ using namespace std;
int n, m, k, x, y, a, b, ans;
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
bool vis[6][6];
struct oo{
struct oo
{
	int x, y, used[6][6];
};

@@ -117,4 +122,3 @@ int main()
	return 0;
}
```