80分求调!!╥﹏╥...

P1104 生日

IAKIOI66666 @ 2024-05-18 21:44:47

#include<bits/stdc++.h>
const int MAXN=1e6+5;
using namespace std;
struct node{
    string s;
    int a,b,c,cnt;
}a[MAXN];
bool cmp(node a,node b){
    if(a.a!=b.a)return a.a<b.a;
    if(a.b!=b.b)return a.b<b.b;
    if(a.c==b.c&&a.b==b.b)return a.cnt>b.cnt;
    if(a.c!=b.c&&a.b==b.b)return a.c<b.c;
}
int n;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i].s>>a[i].a>>a[i].b>>a[i].c;a[i].cnt=a[i].a+a[i].b+a[i].c;
    }
    sort(a+1,a+1+n,cmp);
    for(int i=1;i<=n;i++)cout<<a[i].s<<endl;
    return 0;
}

by pengzy @ 2024-05-18 22:05:33

@IAKIOI66666 你再读一下题目 说的是输入靠后的先输出


by IAKIOI66666 @ 2024-05-18 22:13:28

w(゚Д゚)w,半个小时,白调了


by IAKIOI66666 @ 2024-05-18 22:14:28

@pengzy :谢谢


by pengzy @ 2024-05-19 09:36:31

@IAKIOI66666 求互关


by IAKIOI66666 @ 2024-05-19 09:47:33

ok


|