求助,为什么全都RE
查看原帖
求助,为什么全都RE
777127
sun_fl0wer楼主2022/8/19 20:57
#include<bits/stdc++.h>
using namespace std;

struct stu {
	string name;
	int chi;
	int mat;
	int eng;
	int tot;
} students[10010];

int main(void) {
	int n;
	int score = -1;
	int t = 0;
	stu* p = students;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%s%d%d%d", &((p + i)->name), &((p + i)->chi), &((p + i)->mat), &((p + i)->eng));
		(p + i)->tot = (p + i)->chi + (p + i)->mat + (p + i)->eng;
		if ((p + i)->tot > score) {
			score = (p + i)->tot;
			t = i;
		}
	}
	printf("%s %d %d %d\n", (p + t)->name, (p + t)->chi, (p + t)->mat, (p + t)->eng);
	return 0;
}
2022/8/19 20:57
加载中...