70分求助QwQ

P1093 [NOIP2007 普及组] 奖学金

linzishuai_YZSY @ 2024-12-26 21:57:30

#include<bits/stdc++.h>
using namespace std;
struct an{
    int name,y,s,w;
    int z;
};
an a[5550];
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i].y>>a[i].s>>a[i].w;
    for(int i=1;i<=n;i++)a[i].name=i;
    for(int i=1;i<=n;i++)a[i].z=a[i].y+a[i].s+a[i].w;
    for(int j=1;j<n;j++){
        for(int i=1;i<n;i++){
                if(a[i].z<a[i+1].z)swap(a[i],a[i+1]);
        }
    }
    for(int i=1;i<=5;i++){
        cout<<a[i].name<<" "<<a[i].z<<endl;
    }
    return 0;
}

by Short_person @ 2024-12-26 22:14:25

qp


by Short_person @ 2024-12-26 22:14:42

qwq


by wmy185486abc @ 2025-01-10 13:47:42

?


|