|
|
вернуться в форумruntime error #2 Python import math m = int(input()) mass = [int(input()) for i in range(m)] def bit_sieve(n): if n < 2: return [] bits = [1] * n sqrt_n = int(math.sqrt(n)) + 1 for i in range(2, sqrt_n): if bits[i - 2]: for j in range(i + i, n + 1, i): bits[j - 2] = 0 return bits for j in range(m): k = mass[j] sieve = bit_sieve(int(1.5 * k * math.log(k)) + 1) i = 0 while k: k -= sieve[i] i += 1 print(i + 1) |
|
|