1 solutions

  • 0
    @ 2025-11-5 19:41:19

    Python :

    # coding=utf-8
    try:
        while True:
            line = input()
            if line == "0":
                break
            parts = line.split()
            n = int(parts[0])
            numbers = list(map(int, parts[1:]))
            sorted_numbers = sorted(numbers, key=lambda x: abs(x), reverse=True)
            for num in sorted_numbers:
                print(num, end=" ")
            print()
    except EOFError:
        print()
    
    • 1

    Information

    ID
    19546
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By