为什么我的代码全部CE。。。我定义的结构体编译不了吗?
查看原帖
为什么我的代码全部CE。。。我定义的结构体编译不了吗?
366401
木鸟楼主2020/10/22 19:50
#include <stdio.h>
#include <stdlib.h>

#define MAXA 10
#define MAXB 1010

struct ST
{
	char name[MAXA];
	int chi, mat, eng, tot;
};	ST stu[MAXB];

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