摘要: 泪奔啊!原来STL中的queue那么慢..改了一下午还以为是算法错了呢..#include<stdio.h>#include<string.h>#define inf 0x3f3f3f3fstruct node{ int x,y,step;}a[1000000];int vis[40000][2],ar[201][201],ans[201][201][2],x,y,n;void bfs(int x){ int i,row,col,front=0,tail=1; int dir[4][2]={0,1,1,0,-1,0,0,-1}; while(front!=tail) { 阅读全文
posted @ 2011-10-21 21:28 104_gogo 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 又水了道题,罪过..#include <stdio.h>#include <string.h>int n,m;char board[100][100];int dfs(int x,int y,int num,int d){ int i,row,col,dir[4][2]={0,1,1,0,0,-1,-1,0}; if (num==n*m)return 1; for (i=d;;i++) { row=x+dir[i%4][0]; col=y+dir[i%4][1]; if(row>=0&&col>=0&&row<n& 阅读全文
posted @ 2011-10-21 13:43 104_gogo 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 有点繁杂的一道题,不过还是耐心的A了它,真开心~~注意输出,题目要求不大于最大整数,也是就说如果是3.5,输出3,如果是-3.5,输出-4.#include <stdio.h>#include <math.h>int main(){ int T,a,X,Y,flag; char s[300],*p,*q; scanf("%d",&T); while (T--) { scanf("%s",s); q=p=s; X=Y=0; flag=1; while (flag)//‘=’前部分 { a=0; if (*p>=' 阅读全文
posted @ 2011-10-21 11:51 104_gogo 阅读(281) 评论(0) 推荐(0) 编辑