# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536812 | dantoh000 | Toys (CEOI18_toy) | C++14 | 1281 ms | 4560 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;
set<int> s;
void dp(int n, int sum, int mx){
//printf("%d %d %d\n",n,sum,mx);
s.insert(sum+n-1);
for (int i = 2; i*i <= n && i <= mx; i++){
if (n%i == 0){
dp(n/i, sum+i-1, min(mx,i));
}
}
}
int main(){
int n;
scanf("%d",&n);
dp(n, 0, n);
printf("%d\n",(int)s.size());
for (auto x : s){
printf("%d ",x);
}
}
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... |