sjtu oj 1003.二哥养细菌

#include 
#include 
#include 
using namespace std;
struct point
{
	int x,y;	
	point(int a,int b){x=a;y=b;}
	point(){};
};
int L,res=0,n0=0,n1=0,temp,c[100][100];
queue q;

bool check(int x,int y)
{
	if(x<0||x>=L||y<0||y>=L)
		return false;
	if(c[x][y]!=0)
		return false;
	return true;
}
void f()
{
	temp=0;
	int x,y;
	while(n1--)
	{
		x=q.front().x;
		y=q.front().y;
		q.pop();
		if(check(x-1,y))
		{
			temp++;
			q.push(point(x-1,y));
			c[x-1][y]=1;
		}
		if(check(x,y-1))
		{
			temp++;
			q.push(point(x,y-1));
			c[x][y-1]=1;
		}
		if(check(x,y+1))
		{
			temp++;
			q.push(point(x,y+1));
			c[x][y+1]=1;
		}
		if(check(x+1,y))
		{
			temp++;
			q.push(point(x+1,y));
			c[x+1][y]=1;
		}
		
	}
	n1=temp;
	n0-=temp;

}
int main()
{
	int i,j;
	scanf("%d",&L);
	for(i=0;i

你可能感兴趣的:(sjtu,oj)