不应该着急套用bfs模板

萧瑟秋风今又是换了人间 发表于 1年前 · 关联问题 找女朋友

#include<stdio.h> int main(){ int T,N,M,x1,y1,x2,y2; scanf("%d",&T); while(T--) { scanf("%d%d",&N,&M); scanf("%d%d",&x1,&y1); //input FS x1 and y1 scanf("%d%d",&x2,&y2); //input girl x2 and y2 if(x2>=x1&&y2>=y1) //if girl located at bottom or right of FS printf("%d\n",(x2-x1)+(y2-y1)); //if yes output step else printf("Single dog!\n"); //if no output string } return 0; }