文章

85

粉丝

0

获赞

601

访问

63.3k

头像
国名排序 题解:
P1217 同济大学机试题
发布于 2026年3月
阅读数 571

#include <bits/stdc++.h>
using namespace std;
struct student {
    int id;
    int score;
}s;

bool cmp(student a, student b) {
    if (a.score < b.score) return true;
    if (a.score ==b.score) {
        if (a.id < b.id) return true;
        else return false;
    }
    return false;
}
int main() {
    int n;
    cin>>n;
    vector<string> v;
    for (int i=0;i<n;i++) {
        string s;
        cin>>s;
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    for (int i=0;i<v.size();i++) {
        cout<<v[i]<<endl;
    }
}
登录查看完整内容


登录后发布评论

暂无评论,来抢沙发