UVA 10905 Children ' s game Kids Games

Source: Internet
Author: User

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 ~ ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.