1 条题解
-
0
#include <bits/stdc++.h> #define int long long using namespace std; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } int x, y; signed main() { cin >> x >> y; int ans = 0; for (int P = x; P <= y; P++) { // gcd(P, Q) == x && lcm(P, Q) == y // P*Q == x*y // Q = x * y / P; if (x * y % P != 0) continue; int Q = x * y / P; if (gcd(P, Q) == x && lcm(P, Q) == y) ans++; } cout << ans; return 0; }
- 1
信息
- ID
- 1865
- 时间
- 1000ms
- 内存
- 125MiB
- 难度
- 2
- 标签
- 递交数
- 13
- 已通过
- 5
- 上传者