Advertisement
Void-voiD

Untitled

Feb 17th, 2023
744
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | Source Code | 0 0
  1. def firstMns(n, a):
  2.     for i in range(3):
  3.         mn_val = a[3]
  4.         mn_ind = n - 1
  5.         for j in range(i, n):
  6.             if a[j] < mn_val:
  7.                 mn_val = a[j]
  8.                 mn_ind = j
  9.  
  10.         for k in range(mn_ind - 1, i - 1, -1):
  11.             a[k + 1] = a[k]
  12.         a[i] = mn_val
  13.     print(*a)
  14.  
  15.  
  16. firstMns(int(input()), list(map(int, input().split())))
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement