Odd sort of

Source: Internet
Author: User

Strange Sort time limit: +Ms | Memory Limit:65535KB Difficulty:1
Describe

Recently, Dr Kong has designed a robot bill. This machine man is very clever and can do a lot of things. Only the understanding of the natural number is different from the human, it is reading from right to left. For example, when it sees 123, it will understand 321. Let it compare 23 with 15 which one big, it says 15 big. The reason is that the brain thinks it's 32 versus 51 in comparison. Let's say it compares 29 with 30, it says 29.

Given bill two natural numbers a and B, let it sort all the numbers in the [a, b] interval by small to large. How do you think it is sorted?

input
first row: n indicates how many sets of test data. (2<=n<=5) The
Next has n rows, and each row has two positive integers a B represents the interval range of the elements to be sorted. (1<=a<=b<=200000 b-a<=50)
output
for each row of test data, output a row for all ordered elements, with a space between the elements.
28 
22 
10 8 9 1 1 
30-All-you-could-be-in-a-V-all-in-a-page 
source
fifth session of Henan Province Program design competition
uploader /dt>
acm_ Li Rubing

<span style= "FONT-SIZE:24PX;" > #include <iostream> #include <algorithm> #include <string.h> #include <stdio.h>using namespace Std;struct num{int zhnum;int fannum;int Xuhao;}; int cmp (num a,num b) {return a.fannum<b.fannum;//ascending}int main () {   num a[70];   int N,a,b,i,j,k,len;   Char s[7],b[7];   cin>>n;   while (n--)   {    cin>>a>>b;//total b-a+1 number for   (i=0;i<=b-a;i++)   {   k=0;   A[i].zhnum=a+i;   a[i].xuhao=i;   sprintf (S, "%d", a[i].zhnum);   Len=strlen (s);            for (j=len-1;j>=0;j--) b[k++]=s[j];b[k]= ' + ';   SSCANF (b, "%d", &a[i].fannum);   }   Sort (a,a+b-a+1,cmp);   for (i=0;i<b-a;i++)   cout<<a[i].zhnum<< "";   cout<<a[i].zhnum<<endl;      } return 0;} </span>

Odd sort of

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.