```cpp
#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long a,b;
cin>>a>>b;
long long c,ans=0;
if(b%a!=0)
{
cout<<"0\n";
return 0;
}
c=a*b;
long long j;
for(long long i=a;i<=sqrt(a*b);i+=a)
{
if(c%i==0)
{
j=c/i;
if(__gcd(i,j)==a)
ans++;
}
}
ans*=2;
cout<<ans<<endl;;
return 0;
}
```
by d3NtMDAw @ 2017-11-05 21:49:15
我目测暴搜应该比这慢吧
by Leaves_Flower @ 2017-11-05 21:53:56
@[wusimin000](/space/show?uid=32196) 毕竟这题数据水
by Leaves_Flower @ 2017-11-05 21:54:17
#呃,你不会暴力吗?
by Siyuan @ 2017-11-05 21:59:26
@[wusimin000](/space/show?uid=32196) +1
by Siyuan @ 2017-11-05 22:00:00
都说了最近练搜索啦 @[dingzhuta](/space/show?uid=49725)
by Leaves_Flower @ 2017-11-05 22:01:16
```cpp
#include<bits/stdc++.h>
using namespace std;
int n,m,ans;
int main()
{
scanf("%d%d",&n,&m);
for(int i=1;i<=sqrt(n*m);i++) if((n*m)%i==0 && __gcd(i,(n*m)/i)==n) ans++;
printf("%d",ans*2);
return 0;
}
STL!!!
```
by VenusM1nT @ 2017-11-05 22:20:50
@[流叶](/space/show?uid=41186) 你可以到**试炼场**……
by Siyuan @ 2017-11-05 22:49:13
@[dingzhuta](/space/show?uid=49725) 想尝试一下IDA\* 虽然我还很弱
by Leaves_Flower @ 2017-11-05 23:19:41
@[Venus](/space/show?uid=23243)
```cpp
用
#include<bits/stdc++.h>
会变慢吧,换成小头文件试试?
```
by liuzx418 @ 2018-10-05 21:20:23