Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
78道#include<iostream> #include<string> #define MAX 100 using namespace std; int set[MAX][MAX]; int main() { int lines; cin>>lines; string s; int x,y,L; for(int i=0;i<lines;i++) { cin>>s>>x>>y>>L; int count=0; int Bx = x+L-1; int By = y+L-1; if(s.compare("BLACK")==0) { for(int i = x;i<=Bx;i++) { for(int j = y;j<=By;j++) { set[i][j] = 1; } } } else if(s.compare("WHITE")==0) { for(int i = x;i<=Bx;i++) { for(int j = y;j<=By;j++) { set[i][j] = 0; } } } else { for(int i = x;i<=x+L-1;i++) { for(int j = y;j<=y+L-1;j++) { if(set[i][j] == 1) { count++; } } } cout<<count<<endl; } count=0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator