#include<iostream> #include<vector> using namespace std; int main() { ios_base::sync_with_stdio(false); long long a,n,k; long long res = 0; cin >> n; for(long long a=1; a*a<=n;a++) { if(n%a==0) { k = n/a - 1; for(long long b = 2; b*b <= k; b++) { if(k%b == 0 && a < a*b && a*b < a*b*(k/b - 1)) { res++; if(b*b != k && a < a*b && a*b < a*b*(b - 1)) res++; } } k = a - 1; if(a*a != n) { for(long long b = 2; b*b <= k; b++) { if(k%b == 0 && a < a*b && a*b < a*b*(k/b - 1)) { res++; if(b*b != k && a < a*b && a*b < a*b*(b - 1)) res++; } } } } } cout <<res<<"\n"; 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 | #include<iostream> #include<vector> using namespace std; int main() { ios_base::sync_with_stdio(false); long long a,n,k; long long res = 0; cin >> n; for(long long a=1; a*a<=n;a++) { if(n%a==0) { k = n/a - 1; for(long long b = 2; b*b <= k; b++) { if(k%b == 0 && a < a*b && a*b < a*b*(k/b - 1)) { res++; if(b*b != k && a < a*b && a*b < a*b*(b - 1)) res++; } } k = a - 1; if(a*a != n) { for(long long b = 2; b*b <= k; b++) { if(k%b == 0 && a < a*b && a*b < a*b*(k/b - 1)) { res++; if(b*b != k && a < a*b && a*b < a*b*(b - 1)) res++; } } } } } cout <<res<<"\n"; return 0; } |