摘要:
马走棋盘,搜索。刚开始想打表,发现棋子在边界的时候很难处理,比如a1到b2的话2步是不行的。 用队列,时效差一点点,46MS,代码如下:#include<iostream>#include<deque>using namespace std;struct Point{ char x,y,num;};int main(){ int a,b,i,j; Point x,y; deque<Point> q; char str[2],str2[2]; char visit[8][8]; while(cin>>str>>str2) { m... 阅读全文