#include <bits/stdc++.h> using namespace std; int main() { long long n; scanf("%lld", &n); long long ans = 0; vector<int> divs; for (int a = 1;; a++) { int aa = a * a; if (aa >= n) { if (aa == n) { divs.push_back(a); } break; } if (n % a == 0) { divs.push_back(a); divs.push_back(n/a); } } for (int a : divs) { int t = n / a; if (t >= 7) { int xxy = t - 1; vector<int> xs; for (int x = 2;; x++) { int xx = x * x; if (xx >= xxy) { if (xx == xxy) { xs.push_back(x); } break; } if (xxy % x == 0) { xs.push_back(x); int x2 = xxy / x; if (x2 >= 2) { xs.push_back(x2); } } } for (int x : xs) { int y = xxy / x - 1; if (y >= 2) { ans++; } } } } printf("%lld\n", ans); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | #include <bits/stdc++.h> using namespace std; int main() { long long n; scanf("%lld", &n); long long ans = 0; vector<int> divs; for (int a = 1;; a++) { int aa = a * a; if (aa >= n) { if (aa == n) { divs.push_back(a); } break; } if (n % a == 0) { divs.push_back(a); divs.push_back(n/a); } } for (int a : divs) { int t = n / a; if (t >= 7) { int xxy = t - 1; vector<int> xs; for (int x = 2;; x++) { int xx = x * x; if (xx >= xxy) { if (xx == xxy) { xs.push_back(x); } break; } if (xxy % x == 0) { xs.push_back(x); int x2 = xxy / x; if (x2 >= 2) { xs.push_back(x2); } } } for (int x : xs) { int y = xxy / x - 1; if (y >= 2) { ans++; } } } } printf("%lld\n", ans); return 0; } |