uva 10905 Children's Game

#include "stdio.h"
#include "string"
#include "algorithm"
#include<iostream>
using namespace std;

int cmp(string a,string b)
{
	return a+b>b+a;
}

int main()
{
	int n,i;
	string str[55];
	while(~scanf("%d",&n))
	{
		if(n==0) break;
		for(i=0;i<n;i++) cin>>str[i];
		sort(str,str+n,cmp);
		for(i=0;i<n;i++) cout<<str[i];
			printf("\n");

	}
	return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/

posted @ 2015-02-04 19:38  xryz  阅读(112)  评论(0编辑  收藏  举报