![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
嘻嘻哈哈Man
这个作者很懒,什么都没留下…
展开
-
数独
代码: #include<iostream> using namespace std; int num[10][10]; bool visx[10][10],visy[10][10],vis[10][10]; bool flag=false; void print() { for(int i=0;i<9;i++) { for(int j=0;j<9;j++) ...原创 2020-04-24 00:14:08 · 164 阅读 · 0 评论 -
2n皇后
代码: 先算黑皇后,再算白皇后 #include<iostream> using namespace std; int n,num[10][10],ans=0; bool vis[2][10],col1[2][20],col2[2][20]; bool check(int a,int b,int k) { if(vis[k][b]||num[a][b]==0||col1[k]...原创 2020-04-24 00:11:37 · 141 阅读 · 0 评论 -
奶牛翻块
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate an M × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 15...原创 2020-02-19 22:33:41 · 141 阅读 · 0 评论 -
POJ3126-首相选门牌
题目:http://poj.org/problem?id=3126 The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on thei...转载 2019-11-24 21:57:32 · 67 阅读 · 0 评论 -
DFS求解欧拉回路
思路: 利用欧拉定理判断出一个图存在欧拉通路或欧拉回路; 选择一个正确的起始顶点,用DFS遍历所有的边(每条边只能遍历一次),走不通就回溯; 在搜索前进的方向上将遍历过的边按顺序记录下来; 这组边的排列就组成了一条欧拉通路或回路。 参考 欧拉回路原理:https://blog.csdn.net/PacosonSWJTU/article/details/50007847 代码:https://...原创 2020-01-12 11:59:06 · 1073 阅读 · 0 评论 -
Oil Deposits(油田)
Problem Description The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a ...原创 2019-11-24 21:44:27 · 385 阅读 · 0 评论 -
n皇后
问题描述: 在N*N(N<=10)的棋盘上放N个皇后,使得她们不能相互攻击。两个皇后能相互攻击当且仅当它们在同一行,或者同一列,或者同一条对角线上。找出一共有多少种放置方法。 关于如何判断棋子的斜线方向是否存在棋子可参考:https://www.cnblogs.com/Peper/p/7966253.html 这里以8皇后为例: #include<cstdio> #include...原创 2019-11-24 21:29:10 · 98 阅读 · 0 评论