WA 20分求助
查看原帖
WA 20分求助
1366699
programmer330楼主2024/10/13 16:11
#include<bits/stdc++.h>
using namespace std;
struct student{
	string name;
	int ch,ma,en;
	int total;
};
student a[10001];
int n;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].name>>a[i].ch>>a[i].ma>>a[i].en;
		a[i].total=a[i].ch+a[i].ma+a[i].en;
	}
	long long max=1;
	
	for(int j=2;j<=n;j++){
		if(a[1].total>=a[2].total) max=1;
		else{
			if(a[j].total>=a[j-1].total) max=j;
		}
		
		
	}
	cout<<a[max].name<<" "<<a[max].ch<<" "<<a[max].ma<<" "<<a[max].en;
	
	


	return 0;
}

2024/10/13 16:11
加载中...