/*
8 6 5
hi welcome hello ihateyou goaway dog cat rat
1 hi welcome
1 ihateyou goaway
2 hello ihateyou
2 hi goaway
2 hi hello
1 hi hello
dog cat
dog hi
hi hello
ihateyou goaway
welcome ihateyou
*/
#include <bits/stdc++.h>
#define pii pair <int , int>
#define fi first
#define se second
#define pii pair <int , int>
using namespace std;
const int maxn = 1e5 + 7;
const int mod = 1e9 + 7;
set <int> s;
void dfs(int x , int n , int sum)
{
s.insert(sum + n-1);
int r = x;
while(r*r <= n)
{
if(n%r == 0)
{
int y = n/r;
if(y > r) dfs(y , n/y , sum + (y-1));
dfs(r , n/r , sum + (r-1));
}
r++;
}
}
void solve()
{
int n;
cin >> n;
dfs(2 , n , 0);
cout << s.size() << '\n';
for(int x: s) cout << x << ' ';
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
solve();
return 0;
}
# | 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... |