def solve(n):
d = 0
while not (n&1):
d += 1
n //= 2
a = [2]*d
a[-1] *= n
if d == 1:
print("prime")
return
for x in range(3, int(n**.5)+1, 2):
if not (n%x):
b = a[:]
b[-1] //= x
b[-2] *= x
print("many")
print(" ".join(map(str, a)))
print(" ".join(map(str, b)))
return
print("single")
print(" ".join(map(str, a)))
from sys import stdin
for line in stdin:
print("=== " + line.strip() + " ===")
solve(int(line))
Дайте плз 5 звёзд, мне очень не хватает "Лучших ответов"
Python
Объяснение:
код:
import random
n = random.randint(10, 100)
t = []
p = []
for i in range(1, n):
if n % i == 0:
i = str(i)
t += i
i = int(i)
for k in range(2, i):
if i % k == 0:
i = str(i)
p += i
break
t = list(map(int, t))
p = list(map(int, p))
for x in p:
if x in t:
t.remove(x)
t.remove(1)
if len(t) == 0:
t.append(n)
print(*t)
else:
s = [str(x) for x in t]
print('simple', '(', n, ')', '=', *s)
относится к EV3 походу