(题解见代码)
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int scord[5];
int X[105];
int Y[1005];
int Num[1005];
int Scord[1005];
int main()
{
int n,i=0,j=0,num=0,k=0,flag=0;
memset(Num,0,sizeof(Num));
memset(Scord,0,sizeof(Scord));
memset(scord,0,sizeof(scord));
cin>>n;
for(i=0;i<n;i++)
{
cin>>X[i];
cin>>Y[i];
}
for(i=0;i<n;i++)
{
//判断该点是否可以作为回收站
for(j=0;j<n;j++)
{
if(Y[j]==Y[i]+1&&X[j]==X[i]) Num[i]++;
if(Y[j]==Y[i]-1&&X[i]==X[j]) Num[i]++;
}
for(k=0;k<n;k++)
{
if(X[k]==X[i]+1&&Y[k]==Y[i]) Num[i]++;
if(X[k]==X[i]-1&&Y[k]==Y[i]) Num[i]++;
}
//对回收站点进行评分
for(int a=0;a<n;a++)
{
if(X[i]-1==X[a]&&Y[a]==Y[i]+1) Scord[i]++;
if(X[i]-1==X[a]&&Y[a]==Y[i]-1) Scord[i]++;
if(X[i]+1==X[a]&&Y[a]==Y[i]+1) Scord[i]++;
if(X[i]+1==X[a]&&Y[a]==Y[i]-1) Scord[i]++;
}
}
for(i=0;i<n;i++)
{
//如果该点可以作为回收站,则统计评分相同的点数
if(Num[i]==4) scord[Scord[i]]++;
}
for(j=0;j<5;j++) cout<<scord[j]<<endl;
return 0;
}