Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.CompilerServices;
- using System.Runtime.Remoting.Metadata.W3cXsd2001;
- class Program
- {
- static void Main(string[] args)
- {
- long[] numbers = Console.ReadLine().Split(new char[] { }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
- Comparer<long> evenOddSorter = Comparer<long>.Create((x1, x2) =>
- {
- if (Math.Abs(x1) % 2 == 0 && Math.Abs(x2) % 2 == 1)
- return -1;
- else if (Math.Abs(x1)%2 == 1 && Math.Abs(x2)%2 == 0)
- return 1;
- else
- return 0;
- });
- Array.Sort(numbers, evenOddSorter);
- Console.WriteLine(String.Join(" ", numbers));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement