麻烦大佬们帮忙看看我的20分代码,我实在是找不出错了。。。
查看原帖
麻烦大佬们帮忙看看我的20分代码,我实在是找不出错了。。。
366401
木鸟楼主2020/10/12 20:29
#include <stdio.h>
#include <stdlib.h>

#define MAXA 1010

int main(void)
{
	int n, ans = 0;
	int chi[MAXA], mat[MAXA], eng[MAXA], tot[MAXA];
	
	scanf("%d", &n);
	
	for(int i = 1; i <= n; i++)
	{
		scanf("%d %d %d", &chi[i], &mat[i], &eng[i]);
		tot[i] = chi[i] + mat[i] + eng[i];
	}
	
	for(int i = 1; i <= n; i++)
		for(int j = i + 1; j <= n; j++)
			if(abs(chi[i] - chi[j]) <= 5 && abs(mat[i] - mat[j]) <= 5 && abs(eng[i] - eng[j]) <= 5 && abs(tot[i] - tot[j] <= 10))
				ans++;
	
	printf("%d\n", ans);
	
	return 0;
}
2020/10/12 20:29
加载中...