C++ 求助
查看原帖
C++ 求助
803726
dfsk楼主2022/12/3 15:23
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,sum=0;
	scanf("%d",&n);
	int score[n][4];
	for(int i=1;i<=n;i++){
		scanf("%d%d%d",&score[i][1],&score[i][2],&score[i][3]);
	}
	for(int j=1;j<=n;j++){
		for(int k=1;k<=j;k++){
			if(j!=k and abs(score[j][1]-score[k][1])<=5 and abs(score[j][2]-score[k][2])<=5 and abs(score[j][3]-score[k][3])<=5 and abs((score[j][1]+score[j][2]+score[j][3])-(score[k][1]+score[k][2]+score[k][3]))<=10){
				sum++;
			}
			else{
				continue;
			}
		}
	}
	printf("%d",sum); 
	return 0;
}
2022/12/3 15:23
加载中...