专栏文章
题解:P1072 [NOIP2009 提高组] Hankson 的趣味题
P1072题解参与者 1已保存评论 1
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @miqgxhmy
- 此快照首次捕获于
- 2025/12/04 04:37 3 个月前
- 此快照最后确认于
- 2025/12/04 04:37 3 个月前
题意
求满足 的 个数。
思路
Code
CPP#include <bits/stdc++.h>
#define int long long
#define fro for
using namespace std;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen (".in","r",stdin);
//freopen (".out","w",stdout);
int n;
cin>>n;
while (n--)
{
int a,aa,b,bb;
cin>>a>>aa>>b>>bb;
int sum=0;
for (int i=1;i*i<=bb;i++)
{
if (bb%i==0)
{
int other=bb/i;
if (b*i/__gcd(b,i)==bb&&__gcd(i,a)==aa)
sum++;
if (other!=i/*另一个因数与i不同*/&&b*other/__gcd(b,other)==bb&&__gcd(a,other)==aa)
sum++;
}
}
cout<<sum<<endl;
}
return 0;
}
相关推荐
评论
共 1 条评论,欢迎与作者交流。
正在加载评论...