文章

19

粉丝

0

获赞

60

访问

1.9k

头像
小白鼠排队 题解:
P1229 北京大学机考题
发布于2026年3月19日 20:30
阅读数 252

#include<bits/stdc++.h>
using namespace std;


const int maxn = 105;

struct node{
    int num;
    string color;
}st[maxn];

bool cmp(node a,node b){
    return a.num > b.num;
}

int main(){
    int n;
    while(cin >> n){
        for(int i=0;i<n;i++){
            cin >> st[i].num >> st[i].color;
        }
        sort(st,st+n,cmp);
        for(int i=0;i<n;i++){
            cout << st[i].color << endl;
        }
    }
    return 0;

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发