題目信息:參考鏈接
typedef struct{
int x;
int y;
}point, *pot;
void trash(){
int n, i, j, x, y, flag, sig;
int stat[5] = {0};
pot p;
scanf("%d", &n);
p = (pot)malloc(sizeof(point) * n);
for(i = 0; i < n; i++){
scanf("%d %d", &(p[i].x), &(p[i].y));
}
for(i = 0; i < n; i++){
x = p[i].x;
y = p[i].y;
flag = 0;
sig = 0;
for(j = 0; j < n; j++){
if(p[j].x == x + 1 && p[j].y == y || p[j].x == x - 1 && p[j].y == y || p[j].x == x && p[j].y == y + 1 || p[j].x == x && p[j].y == y - 1){
flag++;
}
else if(p[j].x == x + 1 && p[j].y == y + 1 || p[j].x == x + 1 && p[j].y == y - 1 || p[j].x == x - 1 && p[j].y == y + 1 || p[j].x == x - 1 && p[j].y == y - 1){
sig++;
}
}
if(flag == 4){
stat[sig]++;
}
}
for(i = 0; i < 5; i++){
printf("%d\n", stat[i]);
}
}
int main(){
trash();
return 0;
}