11637 - 231001_11/9_practice8-1
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
-
Input a positive integer n≦20, and then input n integers you need to store in an array.
-
Separate odd and even integers in other two arrays, that means you need to give other two arrays, such as int odd[10],even[10].
-
After you categorize into odd array and even array, you need to sort both arrays in descending order (from big to small), and then print out.
Sort:
-
The most common way to sort is using “Bubble sort.” You need to compare each pair of the elements, and then change the position.
-
-
Please think this algorithm by yourself first, if you still cannot figure out, you may google this algorithm.
Input
Input: A positive integer n and n integers
Input format: After input n, it will change a new line to input n integers, and there is a space between two integers
Output
Output: The sorted odd array and even array
Output format:
-
Print the odd array first, and then the even array.
-
There is a space after each integer, including the last integer.
-
Change a new line after you print each array.
Tags