# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
81805 | xiaowuc1 | Toys (CEOI18_toy) | C++14 | 717 ms | 5264 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.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
set<int> ret;
void solve(int n, int k, int x) {
if(n == 1) {
ret.insert(x);
return;
}
if(n < k) return;
for(int i = k; i * i <= n; i++) {
int t = n;
int nx = x;
while(t%i == 0) {
t /= i;
nx += i-1;
solve(t, i+1, nx);
}
}
ret.insert(n+x-1);
}
void solve(int n) {
solve(n, 2, 0);
}
int main() {
int n;
scanf("%d", &n);
solve(n);
printf("%d\n", ret.size());
for(int x: ret) {
printf("%d", x);
if(x == *ret.rbegin()) printf("\n");
else printf(" ");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |