daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. f = open('input.txt','r')
  2. li = list(map(int,f.read().split(' ')))
  3. li1 = []
  4. li2 = []
  5. li3 = []
  6. ma = max(li)
  7. mi = min(li)
  8. mibra = False
  9. mabra = False
  10. indexmi = 0
  11. indexma = 0
  12. for i in range(len(li)):
  13.     if (not mibra and mi==li[i]):
  14.             indexmi=i
  15.             mibra = True
  16.     if (not mabra and ma==li[len(s)-i-1]):
  17.             indexma=len(s)-i-1
  18.             mabra = True
  19.     if (mibra and mabra):
  20.         break
  21. li1 = li[0:indexmi]
  22. li2 = li[indexmi:indexma+1]
  23. li3 = li[indexma+1:len(li)]
  24. li2.sort()
  25. li1=li1+li3
  26. li1.sort(reverse=True)
  27. f = open('output.txt','w')
  28. for i in range(indexmi):
  29.     f.write(str(li1[i])+' ')
  30. for i in li2:
  31.     f.write(str(i)+' ')
  32. for i in range(indexmi,len(li1)):
  33.     f.write(str(li1[i])+' ')
  34. f.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top