SMRTR - Are You Smarter than a fifth Grader
The Problem is to find are you smarter than a fifth grader or not. You will be given some number between 0 to 9 inclusive. You have to find the maximum and minimum number of nth digit can be generated with the numbers. Believe me or not the problem is taken from the math book of class six.
Input and Output
The input file contains several test cases. Each case contains a Number N(1<=N<=5000). [You have to take input untill end of file....] Next line contains N digits between 0 to 9 inclusive separated by one or more spaces. You can assume that at least one non zero number will exists in the input.
Print the maximum number and minimum number of Nth digits they made in two lines. See Sample input output for Exact format (there is no blank line between two lines of the problems in sample).
Example
Sample Input
5
1 3 2 5 4
Sample Output
54321
12345
hide comments
|
Francky:
2014-03-15 05:29:32
I very well know how to deal it with Python, but I think at beginner user in Python. As input still contains wrong formatting ; problem is hidden waiting for fix and rejudge.
|
|
Kazi Sadlil Rhythm:
2014-03-15 05:29:32
Every one is suggested to code with cin or scanf() in c++/c.... Scanner.nextInt() in java...
|
|
anurag garg:
2014-03-15 05:29:32
AC finally,,,,wrong input caused me 3 TLE
|
|
Francky:
2014-03-15 05:29:32
I ask you, please, to put a '\n' in last line, it cause troubles in some language. Problem will be hidden if not. Thanks for your comprehension. Or you can start the file with the number of test case.
|
|
Bhavik:
2014-03-15 05:29:32
@Mitch: according to my ac solution
|
|
Francky:
2014-03-15 05:29:32
@Mitch:
|
|
Mitch Schwartz:
2014-03-15 05:29:32
The problem is not clear on several points:
|
|
Francky:
2014-03-15 05:29:32
Is the last line feed with a '\n': if no it can explain my NZEC. If you take a look at 99% of spoj problem you'll see that input begins by number of test case. Please feed the last line if need.
|
|
Bhavik:
2014-03-15 05:29:32
there will be multiple cases per file and each case has two lines:1st line N and next line has N space separated integers from 0-9.For each case print two lines having max and minimum possible number.... Last edit: 2014-03-14 18:18:32 |
|
Francky:
2014-03-15 05:29:32
There are several case per file exact ? I didn't saw that before. Usually the number of test cases is given at start. My new code gave NZEC because the number of digits didn't correspond to that announced (and I ask for 1/0). Please explain.
|
Added by: | Kazi Sadlil Rhythm |
Date: | 2014-02-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |