Advertisement
ilnurav

Untitled

Mar 29th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. n = int(input())
  2. a = [int(i) for i in input().split()]
  3. maxmax = 0
  4. k = 0
  5. u = False
  6. s = 0
  7. maxs = 0
  8. f = 0
  9. maxf = 0
  10. for i in range(n):
  11. if a[i] < 5 and not u:
  12. u = True
  13. s = i
  14. if a[i] == 5:
  15. u = False
  16. k = 0
  17. if a[i] < 5 and u:
  18. k += 5 - a[i]
  19. if maxmax < k:
  20. maxmax = k
  21. maxs = s
  22. maxf = i
  23. k = 0
  24. u = False
  25. s = 0
  26. maxs = 0
  27. f = 0
  28. maxf = 0
  29. for i in range(n):
  30. if a[i] < 5 and not u:
  31. u = True
  32. s = i
  33. if a[i] == 5:
  34. u = False
  35. k = 0
  36. if a[i] < 5 and u:
  37. k += 5 - a[i]
  38. if maxmax == k:
  39. print(s + 1, i + 1, k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement