davidbejenariu2

cod python

Jan 4th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. n = int(input())
  2. xs = [x for x in input().split()]
  3.  
  4. arr = []
  5.  
  6. for x in xs:
  7.     if x != '?':
  8.         arr.append(int(x))
  9.     else:
  10.         arr.sort()
  11.         l = len(arr)
  12.  
  13.         if l % 2 == 1:
  14.             print(arr[l//2], end=" ")
  15.         else:
  16.             print((arr[l//2-1] + arr[l//2]) // 2, end=" ")
  17.  
  18.         print(tuple(arr))
Advertisement
Add Comment
Please, Sign In to add comment