摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1238字符匹配 先贴个代码#include<iostream>#include<cstdio>#include<string>#include<cstring>#include<algorithm>using namespace std;struct node{ char s[102]; int len;}a[102];int cmp(const void*a,const void*b){ return (*(node*)a).len>(*(n 阅读全文
posted @ 2011-11-25 22:16 快乐. 阅读(322) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1372象棋中给出起点到终点,马最少走几步?马走日子 ,基础的BFS代码:#include<iostream>#include<queue>#include<string>#include<cstring>#include<cstdio>using namespace std;int a[10][10], visit[10][10];int bx,by,ex,ey;int XX[8][2]={{-2,-1},{-1,-2},{1,-2},{2,-1}, 阅读全文
posted @ 2011-11-25 19:25 快乐. 阅读(229) 评论(0) 推荐(0) 编辑