Main topic:
Give you a bunch of positive integers, let you connect these numbers, find out the biggest one after the connection ...
Ideas see below the code (this is very SB's, don't think more)
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cstring>
#include <string>
using namespace std;
String s[51];
BOOL CMP (const string &s1,const string &s2)
{
if (S1==S2)
return true;
string tem1,tem2;
TEM1+=S1,TEM1+=S2;
TEM2+=S2,TEM2+=S1;
if (TEM1>TEM2)
return true;
return false;
}
int main ()
{
Ios::sync_with_stdio (false);
int n;
while (Cin>>n,n)
{for
(int i=1;i<=n;i++)
cin>>s[i];
Sort (s+1,s+1+n,cmp);
for (int i=1;i<=n;i++)
cout<<s[i];
cout<<endl;
}
return 0;
}
Ideas:
I am a vegetable dog, come up and think about how to manipulate the number of digits so that the number of the largest order in front, when I follow this idea to write the code out of the blood on the screen ~ ~ is also more than a J-hair ah, two numbers a and B, either a in front or b in front, try to know ~ Then I have just written the code deleted, and then over the ~ ~