CompetitiveProgramming/src/bin/test.py

32 lines
696 B
Python
Raw Normal View History

2024-05-09 04:26:34 +01:00
from itertools import pairwise
2024-05-04 10:42:15 +01:00
from random import shuffle, randint
from os import system
2024-05-07 10:27:31 +01:00
def gen_tree(n):
tree = ''
for i in range(2, n + 1):
fa = randint(1, i - 1)
tree += f'{fa} {i}\n'
return tree
2024-04-17 09:42:01 +01:00
2024-05-09 04:26:34 +01:00
N = 10_000_000
prime = []
is_prime = [False] * N
def Eratosthenes(n):
is_prime[0] = is_prime[1] = False
for i in range(2, n + 1):
is_prime[i] = True
for i in range(2, n + 1):
if is_prime[i]:
prime.append(i)
if i * i > n:
continue
for j in range(i * i, n + 1, i):
is_prime[j] = False
2024-05-07 10:27:31 +01:00
if __name__ == '__main__':
2024-05-09 04:26:34 +01:00
print(1)
print(1000000)
print('8 6 ' * 500000)