FZU 2088 最长队名

水题,直接比较一下就可以了

#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;

int n;
const int maxn=10000+10;
struct Name
{
    string name;
} p[maxn];

bool cmp(const Name&a,const Name&b)
{
    return a.name<b.name;
}

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&n);
        for(int i=0; i<n; i++) cin>>p[i].name;
        sort(p,p+n,cmp);
        for(int i=0; i<n; i++) cout<<p[i].name;
        printf("
");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/zufezzt/p/5242616.html