题目//要仔细写的BFS,着重对#穿越的处理哦;//花了几个小时终于把这道简单的BFS给弄好了,我果然还需要增加熟练度,需要再仔细一些;//代码有点乱,但我不想改了,,,,,#include#include#include#includeusing namespace std;struct tt{ int x,y,step,floor;};int visit[20][20][2],n,m,t;char map1[20][20],map2[20][20];queue q;int xx[4]={-1,0,1,0};int yy[4]={0,1,0,-1};int bfs(){ int... Read More
posted @ 2014-01-21 22:42 laiba2004 Views(105) Comments(0) Diggs(0) Edit
题目#include#include#include#includeusing namespace std;struct tt{ int step,tem;};int visit[100010];queue q;int bfs(tt s,tt e){ tt front,temp; q.push(s); visit[s.tem]=1; while(!q.empty()) { front=q.front(); q.pop(); temp.step=front.step+1; temp.tem=front.... Read More
posted @ 2014-01-21 15:26 laiba2004 Views(247) Comments(0) Diggs(0) Edit
重点在判重的方法,嘻嘻题目#define _CRT_SECURE_NO_WARNINGS#include#includeint main(){ int i,j,len,mark[100000],num,flag; char ch[510]; while(gets(ch)) { if(strcmp("*",ch)==0)break; len=strlen(ch); flag=0; for(i=1;i<len;i++) { memset(mark,0,sizeof(mark)); ... Read More
posted @ 2014-01-21 10:07 laiba2004 Views(119) Comments(0) Diggs(0) Edit