Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CustomComparator_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbersArray = Console.ReadLine().Split().Select(int.Parse).ToArray();
- Array.Sort(numbersArray,
- (x, y) =>
- {
- int reminderX = Math.Abs(x % 2);
- int reminderY = Math.Abs(y % 2);
- return reminderX.CompareTo(reminderY);
- });
- Console.WriteLine(string.Join(" ", numbersArray));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment