Powered by:NEFU AB-IN
Article directory
3446. Integer Parity Sort
-
title meaning
Enter 10 integers separated by spaces.
Output after reordering (also separated by spaces), requirements:
first output the odd numbers and arrange them from large to small;
then output the even numbers and arrange them from small to large. -
train of thought
simulation
-
the code
""" Author: NEFU AB-IN Date: 2023/4/18 20:30 software: PyCharm File: 3446.py """ # import import sys, math, os from io import BytesIO, IOBase from collections import Counter, deque from heapq import heapify, heappop, heappush, nlargest, nsmallest from bisect import bisect_left, bisect_right from datetime import datetime, timedelta from typing import * class sa: def __init__(self, x, y): self.x = x self.y = y def __lt__(self, x): pass # Final N = int(1e3 + 10) INF = int(2e9) # Define sys.setrecursionlimit(INF) read = lambda: map(int, input().split()) # —————————————————————Division line —————————————————————— lst = list(read()) a = list(filter(lambda x: x & 1, lst)) b = list(filter(lambda x: x & 1 == 0, lst)) a.sort(reverse=True) b.sort() print(*a, *b)