跳到正文

休闲·娱乐

zheshi

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

文章信息

发布
2026年1月30日
收录
2026年9月4日
更新
2026年9月4日
篇幅
约 2 分钟

版本

  1. v1当前

这是zsyz-oi 这是志南 这是9178 点开look一下

C++
#include<bits/stdc++.h>
using namespace std;
int n,ans=10;
struct stu
{
    int id;
    int x1,x2,x3;
    int a;
}x[1010];
bool c(int i,int j)
{
    if(x[i].a!=x[j].a)return x[i].a>x[j].a;
    if(x[i].x1!=x[j].x1)return x[i].x1>x[j].x1;
    if(x[i].x2!=x[j].x2)return x[i].x2>x[j].x2;
    return x[i].id<x[j].id;
}
int main()
{
    cin>>n;
    int tot=1;
    for(int i=0;i<n;i++)
    {
        cin>>x[i].x1>>x[i].x2>>x[i].x3;
        x[i].id=tot++;
        // cout<<x[i].id<<" ";
        x[i].a=x[i].x1+x[i].x2+x[i].x3;
    }
	for (int i=1;i<n;i++)
	{
        for (int j=0;j<n-i;j++)
        {
            if(!c(j,j+1))swap(x[j],x[j+1]);
        }
    }
    for(int i=10;i<n;i++)
    {
        if(x[9].x1==x[i].x1&&x[9].x2==x[i].x2&&x[9].x3==x[i].x3)ans++;
    }
    for(int i=0;i<ans;i++)
    {
        cout<<x[i].id<<" "<<x[i].a<<endl;
    }
    return 0;
}
// /https://www.luogu.com.cn/team/_/file/yzh104sy/download
原文