摘要: 第一道dfs,值得纪念#include <stdio.h> const int max=5; char map[max][max]; int visit[max][max]; int count,k,maxn,n; int judge(int x,int y) { int i,j; for(i=x,j=y-1;j>=0;j--) { if(visit[i][j]==1) return 0; else if(map[i][j]=='X') break; } for(j=y,i=x-1;i>=0;i--) { if(visit[i][j]==1) retur 阅读全文
posted @ 2012-05-18 23:23 lishimin_come 阅读(144) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <stack> using namespace std; const int maxn=53; int mount; stack<string> s[maxn]; void stackInput(); void moveCard(); void finalOutput(); bool isMatch(string s1,string s2); int main() { string str; while(cin >> str,str!=&qu 阅读全文
posted @ 2012-05-18 20:49 lishimin_come 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 此题不难,典型的DFS,但是却WN了N次。应为本题的测试数据m,n后可能有空格,所以把scanf("%c")改成scanf(“%S);#include <stdio.h> #include <memory.h> const int maxn=100+10; int m,n; int count; int visit[maxn][maxn]; char map[maxn][maxn]; void dfs(int x,int y); int dir[8][2]={{-1,-1},{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1} 阅读全文
posted @ 2012-05-18 20:47 lishimin_come 阅读(179) 评论(0) 推荐(0) 编辑