# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785422 | beaconmc | Toys (CEOI18_toy) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
from math import sqrt, floor
n = int(input())
divs = []
for i in range(1, floor(sqrt(n))+1):
if n%i==0:
divs.append(i)
if i != n//i:
divs.append(n//i)
divs.sort()
divind = dict()
for i in range(len(divs)):
divind[divs[i]] = i
sus = [set() for i in range(len(divs)+1)]
sus[0].add(0)
for i in range(len(divs)):
for j in range(1, len(divs)):
if n%(divs[i] * divs[j]): continue
for k in sus[i]:
sus[divind[divs[i] * divs[j]]].add(k + divs[j]-1)
print(len(sus[-2]))
print(" ".join(map(str, sorted(sus[-2]))))