摘要:Mine NumberTime Limit: 1000ms Memory limit: 65536K有疑问?点这里^_^题目描述Every one once played the game called Mine Sweeping, here I change the rule. You are g...
阅读全文
摘要:看上去并不是很复杂的深搜题,很容易写出可通过测试的代码,但要注意剪枝,这类搜索题考察对剪枝的要求一直没发现,以至于一直TLE。。。虽然代码写得快,但是考虑优化时极其浪费时间,最后在各方面的帮助下 还是写出了AC的代码 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 8 int n,falg,a[70],vis[70],ans; 9 void dfs(int fa,int s,int c)10 {11 12 if(c==1){falg=0;return;}13 if(fa==...
阅读全文
摘要:dfs 有点麻烦,不过也不是很难 1 #include 2 #include 3 #include 4 char str1[205],str2[205],str3[405]; 5 int flag; 6 int len1,len2,len3; 7 int hash[205][205]; 8 void dfs(int a,int b,int c) 9 {10 if(flag)11 return;12 if(c==len3)13 {14 flag=1;15 return;16 }17 if(hash[a][b])18 ...
阅读全文
摘要:算是搜索题吧。。。。 1 /* 2 hdu 1035 Robot Motion 3 简单题 虽然代码有些长 但是写起来简单,不费脑子 4 */ 5 #include 6 #include 7 #include 8 using namespace std; 9 int p;10 int m,n;11 int a[15][15];12 char c[15][15];13 void fun(int x,int y)14 {15 p++;16 if(x=m) throw -2;//需先判断是否出界,否则WA17 if(y=n) throw -2;18 i...
阅读全文