
Benny has a map of his farm, which is an array of marks denoting the distribution of water pipes over the whole farm. For example, if he has a map
ADC
FJK
IHE
then the water pipes are distributed like

Several wellsprings are found in the center of some squares, so water can flow along the pipes from one square to another. If water flow crosses one square, the whole farm land in this square is irrigated and will have a good harvest in autumn.
Now Benny wants to know at least how many wellsprings should be found to have the whole farm land irrigated. Can you help him?
Note: In the above example, at least 3 wellsprings are needed, as those red points in Figure 2 show.
# include<stdio.h>
# include<string.h>
int mark[55][55],m,n;//mark[][]做标记用
int dir[4][2]={-1,0,1,0,0,-1,0,1};//某点的四个方向(分别为上,下,左,右);
int flag[][4]={{1,0,1,0},{1,0,0,1},{0,1,1,0},{0,1,0,1},{1,1,0,0},{0,0,1,1},{1,0,1,1},{1,1,1,0},{0,1,1,1},{1,1,0,1},{1,1,1,1}};//分别标记A~F田的管道开口情况,有则为1,无则为0;注意每块田的管道标记方向也依次为上,下,左,右,与dir[4][2]的方向保持一致,这是本题的关键之处,对于后面的搜索,可简化很多!!
char map[55][55];
struct node {
};
void bfs(int a,int b)
{
}
int main()
{
}