【UOJ#9】vfk的数据

我感觉这题可以出给新高一玩2333

#include<bits/stdc++.h>
#define N 10005
using namespace std;
string s[N];
int n;
bool cmp(const string &a,const string &b){
    if(a.size()!=b.size())return a.size()<b.size();
    else return a<b;
}
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>s[i];
    sort(s+1,s+n+1,cmp);
    for (int i=1;i<=n;i++)cout<<s[i]<<endl;
}
原文地址:https://www.cnblogs.com/zcysky/p/7001329.html