11637 - 231001_11/9_practice8-1   

Description

  1. Input a positive integer n≦20, and then input n integers you need to store in an array.

  2. 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].

  3. 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.

  • https://en.wikipedia.org/wiki/Bubble_sort

  • 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.

Sample Input  Download

Sample Output  Download

Tags




Discuss