-
Notifications
You must be signed in to change notification settings - Fork 0
/
nyist_172.c
51 lines (47 loc) · 949 Bytes
/
nyist_172.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <string.h>
#define bool int
#define true 1
#define false 0
bool map[106][106] = {0};
bool isLegal (int x, int y){
if (x >= 1 && y >= 1 && x <= 100 && y <= 100)return true;
return false;
}
int main ()
{
int n;
char op[6];
int x, y, l;
scanf ("%*s");
while (~scanf ("%s %d%d%d", op, &x, &y, &l)){
int i, j;
if (op[0] == 'B'){
for (i = x; i <= x+l-1 && i <= 100; i ++){
for (j = y; j <= y+l-1 && j <= 100; j ++){
if (isLegal(i, j))
map[i][j] = true;
}
}
}
else if (op[0] == 'W'){
for (i = x; i <= x+l-1 && i <= 100; i ++){
for (j = y; j <= y+l-1 && j <= 100; j ++){
if (isLegal(i, j))
map[i][j] = false;
}
}
}
else if (op[0] == 'T'){
int ans = 0;
for (i = x; i <= x+l-1 && i <= 100; i ++){
for (j = y; j <= y+l-1 && j <= 100; j ++){
if (isLegal(i, j))
if (map[i][j])ans ++;
}
}
printf ("%d\n", ans);
}
}
return 0;
}