# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785422 | 2023-07-17T09:03:28 Z | beaconmc | Toys (CEOI18_toy) | C++14 | 0 ms | 0 KB |
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]))))