#include <bits/stdc++.h> using namespace std; const int inf=1e9+2137; int n,res=0; int count_divisors(int a) { if(a>=0&&a<=5) return 0; int sum,b,rem=2,ans=1; b=a; if(a%2==0) rem++; for(int i=2;i*i<=b;i++) { if(a%i==0) { sum=1; while(a%i==0) { sum++; a/=i; } ans*=sum; } } if(a!=1) ans*=2; return ans-rem; } void read() { cin>>n; } void solve() { for(int i=1;i*i<=n;i++) { if(n%i==0) { res+=count_divisors(i-1); if(i*i!=n) { res+=count_divisors(n/i-1); } } } } void output() { cout<<res; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); read(); solve(); output(); }
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 59 60 61 62 63 64 65 66 67 | #include <bits/stdc++.h> using namespace std; const int inf=1e9+2137; int n,res=0; int count_divisors(int a) { if(a>=0&&a<=5) return 0; int sum,b,rem=2,ans=1; b=a; if(a%2==0) rem++; for(int i=2;i*i<=b;i++) { if(a%i==0) { sum=1; while(a%i==0) { sum++; a/=i; } ans*=sum; } } if(a!=1) ans*=2; return ans-rem; } void read() { cin>>n; } void solve() { for(int i=1;i*i<=n;i++) { if(n%i==0) { res+=count_divisors(i-1); if(i*i!=n) { res+=count_divisors(n/i-1); } } } } void output() { cout<<res; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); read(); solve(); output(); } |