#include<bits/stdc++.h>
using namespace std;
long long licz;
long long a;
void solve2(int b)
{
for(int x=2;x*x<=b;x++)
if(b%x==0)
{
if((b-x)%x==0&&b-x>x)
{
licz++;
//cout<<a/(b+1)<<" "<<a/(b+1)*x<<" "<<a/(b+1)*(b-x)<<'\n';
}
if((b-b/x)%(b/x)==0&&b-b/x>b/x&&x*x!=b)
{
licz++;
//cout<<a/(b+1)<<" "<<a/(b+1)*b/x<<" "<<a/(b+1)*(b-b/x)<<'\n';
}
}
}
void solve(int b)
{
int pom=a/b-1;
solve2(pom);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>a;
for(int x=1;x*x<=a;x++)
if(a%x==0)
{
solve(x);
if(x*x!=a/x)
solve(a/x);
}
cout<<licz;
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 | #include<bits/stdc++.h> using namespace std; long long licz; long long a; void solve2(int b) { for(int x=2;x*x<=b;x++) if(b%x==0) { if((b-x)%x==0&&b-x>x) { licz++; //cout<<a/(b+1)<<" "<<a/(b+1)*x<<" "<<a/(b+1)*(b-x)<<'\n'; } if((b-b/x)%(b/x)==0&&b-b/x>b/x&&x*x!=b) { licz++; //cout<<a/(b+1)<<" "<<a/(b+1)*b/x<<" "<<a/(b+1)*(b-b/x)<<'\n'; } } } void solve(int b) { int pom=a/b-1; solve2(pom); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>a; for(int x=1;x*x<=a;x++) if(a%x==0) { solve(x); if(x*x!=a/x) solve(a/x); } cout<<licz; return 0; } |
English