1 条题解
-
0昌孝阳 (changxiaoyang) LV 10 @ 2023-9-29 13:56:32
#include <bits/stdc++.h>
int gcd(int a, int b) {return !b ? a : gcd(b, a % b);} int lcm(int a, int b) {return a / gcd(a, b) * b;}
int main(int argc, char const *argv[]) { int T, a0, a1, b0, b1; std::cin >> T; while (T--) { scanf("%d%d%d%d", &a0, &a1, &b0, &b1); int kn = sqrt(1.0 * b1), ans = 0; for (int i = 1; i <= kn; i++) if (b1 % i == 0) { if (gcd(i, a0) == a1 and lcm(i, b0) == b1) ans++; if (i != b1 / i and gcd(b1 / i, a0) == a1 and lcm(b1 / i, b0) == b1) ans++; } printf("%d\n", ans); } return 0; }
- 1
信息
- ID
- 111
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 8
- 标签
- 递交数
- 11
- 已通过
- 9
- 上传者