跳到正文

个人记录

测试1

wjm2012约 2 分钟
原文
文章信息与版本

文章信息

发布
2025年5月27日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 2 分钟

版本

  1. v1当前
C++
#include<bits/stdc++.h>
using namespace std;
int n;
struct name{
	int math;
	int english;
	int chinese;
	int zou;
	int mathchinese;
	int p;
	int pai;
}s[10010];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s[i].chinese>>s[i].math>>s[i].english;
		s[i].zou=s[i].math+s[i].english+s[i].chinese;
		s[i].mathchinese=s[i].math+s[i].chinese;
		if(s[i].math>s[i].chinese){
			s[i].p=s[i].math;
		}else{
			s[i].p=s[i].chinese;
		}
		s[i].pai=i;
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(s[i].zou<s[j].zou){
				if(s[i].pai<s[j].pai){
					swap(s[i].pai,s[j].pai);
				}
			}else{
				if(s[i].zou==s[j].zou){
					if(s[i].mathchinese <s[j].mathchinese){
						if(s[i].pai<s[j].pai){
							swap(s[i].pai,s[j].pai);
						}
					}else{
						if(s[i].mathchinese ==s[j].mathchinese){
							if(s[i].p<s[j].p){
								if(s[i].pai<s[j].pai){
									swap(s[i].pai,s[j].pai);
							}
							}else{
								if(s[i].p==s[j].p){
									if(s[i].pai<s[j].pai){
										s[j].pai=s[i].pai;
									}else{
										s[i].pai=s[j].pai;
									}
							}
						}
						}
					}
				}
			}
		}
	}
	for(int i=1;i<n;i++){
		cout<<s[i].pai<<endl;
	}
	cout<<s[n].pai; 
	return 0;
}
原文