goodsnack @ 2024-11-22 11:59:13
要实现输入靠后的同学先输出
by ckn0915 @ 2024-11-27 17:56:03
@goodsnack
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
string d[n];
int a[n],b[n],c[n];
for(int i=0;i<n;i++){
cin>>d[i]>>a[i]>>b[i]>>c[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(a[i]>a[j]){
string a1="";
int t;
a1=d[i];
d[i]=d[j];
d[j]=a1;
t=a[i];
a[i]=a[j];
a[j]=t;
t=b[i];
b[i]=b[j];
b[j]=t;
t=c[i];
c[i]=c[j];
c[j]=t;
}
if(a[i]==a[j]){
if(b[i]>b[j]){
string a1="";
int t;
a1=d[i];
d[i]=d[j];
d[j]=a1;
t=a[i];
a[i]=a[j];
a[j]=t;
t=b[i];
b[i]=b[j];
b[j]=t;
t=c[i];
c[i]=c[j];
c[j]=t;
}
if(b[i]==b[j]){
if(c[i]>c[j]){
string a1="";
int t;
a1=d[i];
d[i]=d[j];
d[j]=a1;
t=a[i];
a[i]=a[j];
a[j]=t;
t=b[i];
b[i]=b[j];
b[j]=t;
t=c[i];
c[i]=c[j];
c[j]=t;
}
}
}
}
}
for(int i=0;i<n;i++) cout<<d[i]<<endl;
return 0;
}
八十分
by ___ZHY @ 2024-12-06 22:32:45
@ckn0915我咧个模拟啊 用结构体不好吗
by ckn0915 @ 2024-12-07 10:08:34
@___ZHY 不会