您的位置:首页 > 其它

Uva 10905 Children's Game

2016-04-24 23:12 274 查看
题意:给定n个正整数,求他们能拼接成的最大整数是多少。

白书诚不欺我,果然wa了好久....

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
string s[51];
bool camp(string a,string b)
{
return a + b > b + a;
}
int main()
{
cin.sync_with_stdio(false);
while(cin>>n && n)
{
for(int i = 1;i <= n;i++) cin>>s[i];
sort(s+1,s+1+n,camp);
for(int i = 1;i <= n;i++) cout<<s[i];
cout<<endl;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: