Илья Лысцов, 321 группа AlmostRandom 5311 | Акопян Артур, 527 группа, магистратура AlmostRandom 6016 | ||||
---|---|---|---|---|---|
f | 1 | import random | f | 1 | import random |
2 | 2 | ||||
3 | def divrandom(a, b, s, p): | 3 | def divrandom(a, b, s, p): | ||
n | 4 | if s % p == 0 and a % p == 0: | n | 4 | if a % p == 0 and s % p == 0: |
5 | return 0 | 5 | return 0 | ||
6 | while True: | 6 | while True: | ||
t | 7 | x = random.randrange(min(a, b), max(a, b) + 1, s) | t | 7 | number = random.randrange(min(a, b), max(a, b) + 1, step=s) |
8 | if x % p != 0: | 8 | if number % p != 0: | ||
9 | return x | 9 | return number |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|