Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import random
  2.  
  3. N = int(input(' > '))
  4. K = N
  5. L = []
  6. min_times = 0
  7. temporary_time = 0
  8. iterations = 1000000
  9.  
  10. for i in range(N):
  11. L.append(input(' > '))
  12.  
  13. for i in range(iterations):
  14. for i in L:
  15. if N <= 0 :
  16. break
  17. j = random.randint(0,2)
  18. k = i.split()[j]
  19. temporary_time += int(k)
  20. N -= j + 1
  21.  
  22. if min_times == 0 or temporary_time < min_times:
  23. min_times = temporary_time
  24.  
  25. temporary_time = 0
  26. N = K
  27.  
  28. print(min_times)
  29. input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement