20分求助
查看原帖
20分求助
235454
wyb0412楼主2020/5/16 18:26
#include<bits/stdc++.h>
using namespace std;
int ans,n,i,j;

struct node{
	int yu,shu,ying;
}a[1005];

int main(){
	cin>>n;
	
	for(i=1;i<=n;i++)
	cin>>a[i].yu>>a[i].shu>>a[i].ying;
	
	for(i=1;i<=n-1;i++)
	for(j=i+1;j<=n;j++){
		int ans1=a[i].yu+a[i].shu+a[i].ying;
		int ans2=a[j].yu+a[j].shu+a[j].ying;
		
		if(fabs(a[i].yu-a[j].yu)<=5&&
		   fabs(a[i].shu-a[j].shu)<=5&& 
		   fabs(a[i].ying-a[j].ying<=5)&&
		   fabs(ans1-ans2)<=10) ans++;
	}
	
	cout<<ans;
	return 0;
}

20分求助

2020/5/16 18:26
加载中...