蒟蒻求助
查看原帖
蒟蒻求助
1460836
Retribution321楼主2024/11/22 15:52
#include<bits/stdc++.h>
using namespace std;
#define pzq(a,b,c) for(int a=b;a<c;a++)
#define qzp(a,b,c) for(int a=b;a>=c;a--)

struct chengji{
		int chinese,math,english;
	};
int main(){
	int n;
	cin>>n;
	chengji a[n+1];int score[n+1];
	pzq(i,1,n+1){
		cin>>a[i].chinese>>a[i].math>>a[i].english;
		score[i]=a[i].chinese+a[i].math+a[i].english;
	}
	int num=0,ans=0;
	pzq(i,1,6){
		pzq(j,1,n+1){
			if(score[j]>ans)ans=score[j];num=j;continue;
			if(score[j]==ans){
				if(a[num].chinese>=a[j].chinese)continue;
				if(a[num].chinese<a[j].chinese)ans=score[j];num=j;continue;
			}
			else continue;
		}
		cout<<num<<" "<<ans<<endl;
		score[num]=0;
		num=0;ans=0;
	}
	return 0;
}
2024/11/22 15:52
加载中...