10976 Fractions Again It is easy to see that for every fraction in the form 1 k (k > 0), we can always find two positive integers x and y, x ≥ y, such that: 1 k = 1 x + 1 y Now our question is: can you write a program that counts how many such pairs…
[题意]:给你一个数k,求所有使得1/k = 1/x + 1/y成立的x≥y的整数对. [分析]:枚举所有在区间[k+1, 2k]上的 y 即可,当 1/k - 1/y 的结果分子为1即为一组解. [代码]: #include<bits/stdc++.h> using namespace std; int x[10005]; int y[10005]; #define LL long long int main() { int k,c; while(~scanf("%d",…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] x>=y => \(\frac{1}{x}<=\frac{1}{y}\) => \(\frac{1}{x}=\frac{1}{k}-\frac{1}{y}\) 结合两个式子可以得到 y<=2*k 则枚举y,然后根据式子得到x,判断合法性就ok [代码] /* 1.Shoud it use long long ? 2.Have you ever test several sample(at least ther…
It is easy to see that for every fraction in the form (k > 0), we can always find two positive integers x and y,x ≥ y, such that: . Now our question is: can you write a program that counts how many such pairs of x and y there are for any givenk? Inp…
题目链接:https://vjudge.net/problem/UVA-10976 It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive integers x and y, x ≥ y, such that: 1/k=1/x+1/y Now our question is: can you write a program that counts how ma…