| ||||||||||
| 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 | |||||||||
我哪里没有初始化吗?怎么会运行不了#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int size = 105;
bool isBlack[size][size];
int main()
{
int n,x,y,L,count;
char command[10];
for(int i = 0; i < size; i++)
for(int j = 0; j < size; j++)
isBlack[i][j] = false;
cin >> n;
while(n--){
cin >> command >> x >> y >> L;
if(strcmp(command,"BLACK")== 0){
for(int i = x; i <= x+L-1; i++)
for(int j = y; i <= y+L-1; j++)
isBlack[i][j] = true;
}
else if(strcmp(command,"WHITE")== 0){
for(int i = x; i <= x+L-1; i++)
for(int j = y; i <= y+L-1; j++)
isBlack[i][j] = false;
}
else if(strcmp(command,"TEST") == 0){
count = 0;
for(int i = x; i <= x+L-1; i++)
for(int j = y; i <= y+L-1; j++)
if(isBlack[i][j])count ++;
cout << count << endl;
}
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator