文章

93

粉丝

56

获赞

264

访问

21.4k

头像
大整数排序 题解:暴力
P1412 华中科技大学机试题
发布于2025年3月15日 11:17
阅读数 213

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

bool cmp(string a,string b)
{
    if(a.length()!=b.length())
    {
        return a.length() < b.length();
    }
    return a<b;
}

int main()
{
    int n;
    while(cin>>n)
    {
        vector<string> num;
        string str;
        while(n--)
        {
            cin>>str;
            num.push_back(str);
        }
        stable_sort(num.begin(),num.end(),cmp);
        vector<string>::iterator it;
        for(it=nu...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发