Могиленец Виктор, Севастополь AlmostRandom 6696 | Stanislav AlmostRandom 6246 | ||||
---|---|---|---|---|---|
f | 1 | import random | f | 1 | import random |
2 | 2 | ||||
3 | def divrandom(a, b, s, p): | 3 | def divrandom(a, b, s, p): | ||
4 | if a > b: | 4 | if a > b: | ||
5 | a, b = (b, a) | 5 | a, b = (b, a) | ||
6 | for _ in range(100): | 6 | for _ in range(100): | ||
t | 7 | x = random.randrange(a, b + 1, s) | t | 7 | num = random.randrange(a, b + 1, s) |
8 | if x % p != 0: | 8 | if num % p != 0: | ||
9 | return x | 9 | return num | ||
10 | return 0 | 10 | return 0 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|