摘要:
http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1010这道题是要我们找到一个队伍的最后一个骆驼的编号,队伍的要求有两点1. 骆驼数最少2. 与池塘相连#include<cstdio>#include<cstring>#include<cstdlib>#define MAXN 100005int next[MAXN], s[MAXN];int N, top, k;int main(){ while( scanf( "%d", &N) == 1) { int n = N; top = 阅读全文
posted @ 2011-12-13 22:18
找回失去的
阅读(208)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=3620学长说这道题是广搜题,但是貌似用深搜做更容易,将被淹了的点标记为true,然后对其上下左右4个点进行深搜,找到相连的最多的点。/*Accepted 288K 47MS C++ 1080B 2012-07-23 12:20:58*/#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>using namespace std;const int MAXN = 105;const int dx[] = { 1, 阅读全文
posted @ 2011-12-13 20:32
找回失去的
阅读(212)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=1753这道题用的深搜,操作方式还是蛮麻烦的 o(2^16) ,然后在读入的时候用了%c然后悲剧了...#include<cstdio>#include<cstring>#include<cstdlib>int map[4][4];int dx[] = { 1, -1, 0, 0};int dy[] = { 0, 0, -1, 1};int min = 100;void init(){ char a[10]; for( int i = 0; i < 4; i ++) { scanf( "%s 阅读全文
posted @ 2011-12-13 20:15
找回失去的
阅读(175)
评论(0)
推荐(0)
浙公网安备 33010602011771号