0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-26 07:52:00 +00:00
OI-codes/S2OJ/782/782.cpp

24 lines
543 B
C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
long long n, ans[10000005];
int main() {
std::ios::sync_with_stdio(false);
cin >> n;
for (long long i = 1; i * i <= n; i++) {
if (n % i) continue;
if ((i & 1ll) && i != 1) ans[++ans[0]] = n / i * (i - 1);
if (((n / i) & 1ll) && n / i != 1) ans[++ans[0]] = i * (n / i - 1);
}
sort(ans + 1, ans + 1 + ans[0]);
for (int i = 0; i <= ans[0]; i++) {
cout << ans[i] << ' ';
}
cout << endl;
return 0;
}