油田问题,有点像图像处理里的区域生长问题,找油田块数。BFS,DFS都可以。 1 /*BFS*/ 2 #include 3 #include 4 const int maxn=100+5,maxm=1000; 5 int m,n,vis[maxn][maxn],mat[maxn][maxn],dir...
分类:
其他好文 时间:
2014-07-18 16:19:41
阅读次数:
267
BFS题,只是没有目标位置,只需记下走过的黑色的块数就行 1 #include 2 #include 3 const int maxn=1000,maxm=25; 4 int vis[maxm][maxm],mat[maxm][maxm],dir[5][3]={{1,0},{0,-1},{-1,0}...
分类:
其他好文 时间:
2014-07-18 16:12:09
阅读次数:
267
DFS题,类似八皇后问题,题目有点长,看了老半天才看懂。特别是上下左右数字要注意。还要注意剪枝,另外空行不能多输,输多了不能AC(运行速度有点慢,能AC但1940ms,估计还有待优化) 1 #include 2 #include 3 const int maxn=25+5; 4 int num[ma...
分类:
其他好文 时间:
2014-07-18 09:24:14
阅读次数:
213
K - Kinds of Fuwas Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluDescriptionIn the year 2008, the 29th Olympic Games will be held ...
分类:
其他好文 时间:
2014-07-18 00:19:24
阅读次数:
357
E - Easy TaskDescriptionCalculating the derivation of a polynomial is an easy task. Given a function f(x) , we use (f(x))' to denote its derivation. W...
分类:
其他好文 时间:
2014-07-18 00:15:29
阅读次数:
262
F - Faster, Higher, Stronger Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluSubmit Status Practice ZOJ 2970DescriptionIn the year 2...
分类:
其他好文 时间:
2014-07-18 00:05:06
阅读次数:
253
A - Accurately Say "CocaCola"!DescriptionIn a party held by CocaCola company, several students stand in a circle and play a game.One of them...
分类:
其他好文 时间:
2014-07-18 00:01:04
阅读次数:
239
其实就是枚举最高点和起点,然后以最高点为源点在两张图上分别做spfa。一遍最短路,一遍最长路。暴露出来的问题:思维不够清晰,代码能力还不够#include #include #include #include #include #include #include #include #include ...
分类:
其他好文 时间:
2014-07-17 18:16:43
阅读次数:
206
这题要用BFS去做,要注意的是’x‘,这里可以有优先队列去做,会很简单;另一个要注意的是,a只有一个,r可能有很多个,所以可以用a去找最接近的r;#include #include #include "string.h"using namespace std;struct step{ int x,y...
分类:
其他好文 时间:
2014-07-17 18:13:36
阅读次数:
180
GridlandTime Limit:2 Seconds Memory Limit:65536 KBBackgroundFor years, computer scientists have been trying to find efficient solutions to different c...
分类:
其他好文 时间:
2014-07-17 18:12:39
阅读次数:
247