Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

sdgfd

Posted by 904013041 at 2005-01-07 20:04:57 on Problem 1656
#include <stdio.h>
#include <iostream.h>
#include <string.h>
int a[100][100]={0};
void f1(int x,int y,int l){
	int i,j;
	for(i=x-1;i<=x+l-2;i++){
		for(j=y-1;j<=y+l-2;j++)
			a[i][j]=1;
	}
}
void f2(int x,int y,int l){
	int i,j;
	for(i=x-1;i<=x+l-2;i++){
		for(j=y-1;j<=y+l-2;j++)
			a[i][j]=0;
	}
}
void f3(int x,int y,int l){
	int i,j,count=0;
	for(i=0;i<100;i++){
		for(j=0;j<100;j++){
			if(a[i][j]==1)
				count++;
		}
	}
	cout<<count<<endl;
}
void main(){
	char order[100][10]={'0'};
	int x,y,l;
	int t,i;
	cin>>t;
	for(i=0;i<t;i++){
		cin>>order[i]>>x>>y>>l;
		if(strcmp(order[i],"BLACK")==0)
			f1(x,y,l);
		else {
			if(strcmp(order[i],"WHITE")==0)
			     f2(x,y,l);
		    else f3(x,y,l);
		}
	}
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator