搜索
沙茶
这个作者很懒,什么都没留下…
展开
-
[codevs3492] 细胞个数
题目链接思路:dfs#include <iostream> #include <cstdio> #include <cstring> using namespace std; int m,n,tot; int dx[]={0,1,-1,0,0}; int dy[]={0,0,0,1,-1}; char s[1005][1005]; int map[1005][1005]; int vis[1005]原创 2016-07-05 11:32:15 · 274 阅读 · 0 评论 -
[Usaco08Open] Roads Around The Farm
题目链接题解:按照题意一步步模(乱)拟(搞)#include <iostream> #include <cstdio> using namespace std; int n,k,tot; void dfs(int x) { int f=(x+k)>>1,s=(x-k)>>1;//分成差为K的两部分(不保证可行) if(f>0&&s>0&&f+s==x){//方案可行 dfs(原创 2016-11-07 21:21:20 · 222 阅读 · 0 评论 -
[luogu2932&Usaco09Jan] Earthquake Damage
题目链接题解:玄学搜……#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int M=30005; int n,m,k,x,y,ans,t; bool vis[M]; int head[M]; struct edge{ int to,next; }e[M*7]; void a原创 2016-10-16 11:11:00 · 245 阅读 · 0 评论 -
[noip2014tg] 寻找道路
题目链接题解:正着搜一遍,反向再搜一遍……#include <iostream> #include <cstdio> #include <climits> #include <cstring> #include <queue> using namespace std; const int M=10005; #define INF INT_MAX-100000 int m,n,z,t,k,st,et;原创 2016-10-02 09:26:15 · 201 阅读 · 0 评论 -
[luogu1162 填涂颜色]
题目链接题解:搜吧#include <iostream> #include <cstdio> using namespace std; int n,flag,x; int map[50][50]; bool check(int x,int y){ if(x<1||y<1||x>n||y>n||map[x][y]!=2) return 0; return 1; } void dfs(i原创 2016-10-16 11:09:07 · 192 阅读 · 0 评论 -
[luogu1141 01迷宫]
题目链接题解:记忆化#include <iostream> #include <cstdio> using namespace std; const int M=1005; int n,m,x,y; int map[M][M],ans[M*100]; int vis[M][M]; char s[M][M]; bool check(int i,int j,int z){ if(i>n||j>n原创 2016-10-16 11:07:34 · 138 阅读 · 0 评论 -
[codevs1294] 全排列
题目链接#include <iostream> #include <cstdio> using namespace std; int n,s; int a[100],vis[100]; void print() { for(int i=1;i<=n;i++) printf("%d ",a[i]); printf("\n"); } int dfs(int x) { if原创 2016-06-28 08:27:14 · 201 阅读 · 0 评论 -
[codevs1174] 靶形数独
题目链接 #include <cstdio> #include <iostream> #include <algorithm> using namespace std; const int n=9; int s,tot,ans; int a[10][10]; struct data{ bool h,l,k; }f[10][10]; int fen[10][10]={{0,0,0,0,0,原创 2016-06-27 10:21:19 · 241 阅读 · 0 评论 -
[codevs3143] 二叉树的序遍历
题目链接#include <iostream> #include <cstdio> using namespace std; int n,c; int lc[100],rc[100]; void q(int sp) { if(sp) { cout<<sp<<" "; q(lc[sp]); q(rc[sp]); } } void原创 2016-06-28 08:59:00 · 197 阅读 · 0 评论 -
[codevs1116] 四色问题
题目链接#include <iostream> #include <cstdio> using namespace std; int n,s; int f[10][10]; int color[100]; void dfs(int x) { if(x>n)//每当找到1个方案 { for(int i=1;i<=n;i++) for(int j=1;j原创 2016-07-01 11:22:41 · 704 阅读 · 0 评论 -
[codevs2152] 滑雪
题目链接思路:记忆化,dfs#include <cstdio> #include <iostream> #include <cstring> using namespace std; int r,c; int map[110][110],f[110][110]; int dx[5]={0,-1,0,1,0}; int dy[5]={0,0,1,0,-1};bool check(int a,int b原创 2016-07-05 10:47:40 · 199 阅读 · 0 评论 -
[codevs1026] 逃跑的拉尔夫
题目链接题解:闷声大暴力啊啊啊啊#include <iostream> #include <cstdio> #include <cstring> using namespace std; const int maxn=55; int r,c,sx,sy,n; char s[maxn][maxn],ans[maxn][maxn]; int map[maxn][maxn],vis[maxn][maxn]原创 2016-11-16 17:52:49 · 211 阅读 · 0 评论