摘要: #include<stdio.h>#include<string.h>#define INF 0xfffffffstruct point { int x; int y;};int step[301][301];struct point que[30000001];int main(){ struct point p1, p2; while(scanf("%d %d %d %d", &p1.x, &p1.y, &p2.x, &p2.y) != EOF) {// memset(step, 0, sizeof(step)); 阅读全文
posted @ 2012-10-31 23:36 小猴子、 阅读(358) 评论(2) 推荐(0) 编辑
摘要: 题目连接;http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1179#include<stdio.h>#include<string.h>int a[101][101];int visited[101][101];int n, m;int dfs(int i, int j){ if( visited[i][j] ) return visited[i][j]; int sum = 0; if(i - 1 >= 0 && a[i][j] &g 阅读全文
posted @ 2012-10-31 23:34 小猴子、 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 题目连接http://poj.org/problem?id=1562大致题意:给出一个图找出一共多少块油田。油田用‘@’表示,与它相邻的8个区域如果还有油田‘@’则视为一块。#include<stdio.h>char grid[101][101];int n, m;int dir[8][2] = { {-1, -1}, {-1, 0}, {-1, 1}, { 0, 1}, { 1, 1}, { 1, 0}, { 1, -1}, { 0, -1}};void dfs(int x, int y){ int a, b; grid[x][y] = '*'; for(int 阅读全文
posted @ 2012-10-31 20:59 小猴子、 阅读(313) 评论(0) 推荐(0) 编辑
摘要: 题目连接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1110大致题意:第一行n,m,t代表n行m列的图,t是门开的时间,门开不超过1s。接下来n行m列的图。'.'代表通路'X'代表墙'S'代表初始位置'D'代表门的位置要求必须在t秒钟从S到达D,能到输出YES,否则输出NO。#include<stdio.h>char gird[8][8];int n, m, t, ans, a1, b1;void dfs(int i, int j, int k 阅读全文
posted @ 2012-10-31 20:11 小猴子、 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 转载:http://blog.csdn.net/guo_love_peng/article/details/6618170 int get_nextval(SString T,int &nextval[ ]){ //求模式串T的next函数修正值并存入数组nextval。 i=1; nextval[1]=0; j=0; while(i<T[0]){ if(j==0||T[i]==T[j]){ ++i;++j; if (T[i]!=T[j]) nextval[i]=j; else nextval[i]=nextval[j]; } else j... 阅读全文
posted @ 2012-10-31 00:44 小猴子、 阅读(427) 评论(0) 推荐(0) 编辑