0分求助......
查看原帖
0分求助......
669486
sansssss楼主2022/5/22 09:24

不知道自己哪里错了,求助大佬

#include <bits/stdc++.h>
using namespace std;
int main () {
	int n, yw[1001], sx[1001], yy[1001], zf[1001];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> yw[i] >> sx[i] >> yy[i];
		zf[i] = yw[i] + sx[i] + yy[i];
	} 
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = i + 1; j <= n; j++) {
			int w = abs(yw[i] - yw[j]);
			int s = abs(sx[i] - sx[j]);
			int y = abs(yy[i] - yy[j]);
			int z = abs(zf[i] - zf[j]);
			if (w <= 5 && s <= 5 && y <= 5 && z <= 5) {
				ans++;
			}
		}
	}
	cout << ans;
	return 0;
} 
2022/5/22 09:24
加载中...