摘要:#include char map[101][101]; int vis[101][101]; typedef struct node { int x; int y; }node; node queue[10000]; int n,m; int dx[8]={-1,-1,-1,0,1,1,1,0}; int dy[8]={-1,0,1,1,1,0,-1,-1}; int ...
阅读全文
摘要:#include using namespace std; int n; int map[21][21]; int c1[21],c2[21]; int count1,count2; int maxsum; void dfs(int step,int count1, int count2) { if(step==n) { int sum=0; f...
阅读全文
摘要:#include #define MAX 100001 int john,cow; int queue[MAX]; int vis[MAX]; int ans; void bfs() { int tail,head; tail=head=0; int start=john; queue[tail++]=start; vis[start]=1; w...
阅读全文