Advertisement
Olegos

Ну очень длинная последовательность

May 4th, 2022
798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. N, K = 3, 2
  2. a0, x, y = 3, 1, 2
  3.  
  4. result = [a0]
  5. for i in range(1, N+1):
  6.     result.append((x * result[i-1] + y) % 2**30)
  7.  
  8. print(sorted(result)[1:K+1])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement