hdu 1426 Sudoku Killer(数独)(深搜)
摘要:题意:数独注意:小方格内的数判断,先将整个数组按照3*3的方格划分成9个区域。123456789View Code #include <iostream>using namespace std;int map[12][12];int used[12][12];//判断9个格子中是否存在要填得数int used1[12][12];//判断这一行中是否存在要填的数int used2[12][12];//判断这一列中是否存在要填的数char ch;int sum;int temp=0;int flag;struct node{ int i,j;}step[90];int panduan(
阅读全文
hdu 1258 Sum It Up(深搜)
摘要:题意:找到不重复的,加起来等于给定的数。连接:http://acm.hdu.edu.cn/showproblem.php?pid=1258View Code #include <iostream>#include <algorithm>using namespace std;int used[15];//标记的数int save[15];//保存更新的数int step[15];//输入的数int n,m;int sum,type;int cmp(int a,int b){ return a>b;}void dfs(int k,int x){ if(k==n) {
阅读全文
hdu 2616 Kill the monster(深搜)
摘要:题意:找到最小步骤杀死monster连接:http://acm.hdu.edu.cn/showproblem.php?pid=2616View Code #include <iostream>using namespace std;int map[15][3];int used[15];int n;int sum,temp,type;int Min=100000000;void dfs(int k,int m){ if(k==n+1)//当到达第K层的时候就不在递归下去了 { if(m>0) { return; ...
阅读全文