import java.util.Scanner;
public class 回收站选址 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[][] a=new int[2][n];
for(int i=0;i<n;i++){
a[0][i]=sc.nextInt();
a[1][i]=sc.nextInt();
}
int f0=0;
int f1=0;
int f2=0;
int f3=0;
int f4=0;
for(int j=0;j<n;j++){
int x=a[0][j];
int y=a[1][j];
int count=0;
int s=0;
for(int i=0;i<n;i++){
if(a[0][i]==x&&a[1][i]==y+1){
count++;
}else if(a[0][i]==x&&a[1][i]==y-1){
count++;
}else if(a[0][i]==x+1&&a[1][i]==y){
count++;
}else if(a[0][i]==x-1&&a[1][i]==y){
count++;
}else if(a[0][i]==x-1&&a[1][i]==y-1){
s++;
}else if(a[0][i]==x-1&&a[1][i]==y+1){
s++;
}else if(a[0][i]==x+1&&a[1][i]==y-1){
s++;
}else if(a[0][i]==x+1&&a[1][i]==y+1){
s++;
}
}
if(count==4){
if(s==0){
f0++;
}else if(s==1){
f1++;
}else if(s==2){
f2++;
}else if(s==3){
f3++;
}else if(s==4){
f4++;
}
}
}
System.out.println(f0);
System.out.println(f1);
System.out.println(f2);
System.out.println(f3);
System.out.println(f4);
}
}
CCF CSP刷题记录33——201912-2回收站地址(Java)
猜你喜欢
转载自blog.csdn.net/m0_37483148/article/details/108419891
今日推荐
周排行