-
链接
Fractions Again?!
-
思路
因为 ,又因为 ,所以 ,即 ,枚举y判断x即可。
-
代码
#include<bits/stdc++.h> using namespace std;typedef long long ll; const int maxn = 2e5+10; const int mod = 1e9+7;int a[maxn];int main(void){int k;while(cin>>k){int cnt = 0;for(int y = k+1; y <= 2*k; y++){int a1 = k*y;int a2 = y-k;if(a1%a2==0) cnt++;}cout<<cnt<<endl;for(int y = k+1; y <= 2*k; y++){int a1 = k*y;int a2 = y-k;if(a1%a2==0){int x = a1/a2;printf("1/%d = 1/%d + 1/%d\n",k,x,y); }}} return 0; }
详细解决方案
UVA10976-Fractions Again?!【枚举】
热度:34 发布时间:2024-02-10 11:30:54.0
相关解决方案
- POJ 1131 Octal Fractions 高精度小数+JAVA .
- UVa - 10976 - Fractions Again?!(暴力求解枚举)
- Fractions Again?! UVA - 10976
- Octal Fractions POJ - 1131
- 2018-2019 ICPC, NEERC, Northern Eurasia Finals F Fractions (数论)
- E - Fractions Gym - 102058E
- UVa 10976 Fractions Again?!(分数拆分)
- UVA-10976 Fractions Again?!(分数拆分)(枚举)
- 欧拉工程第33题:Digit cancelling fractions
- Python-4-数据类型-续Numbers(math、random、decimal、fractions)
- 743C. Vladik and fractions codeforces
- C - Fractions Again?! (暴力)
- POJ 1131 Octal Fractions (java高精度进制转换)
- [U]2.4.5 Fractions to Decimals 简单的语言控制题
- Codeforces743 C. Vladik and fractions(构造)
- UVA10976-Fractions Again?!【枚举】
- 计蒜客----F. Fractions
- F. Fractions(exgcd)
- 16行代码AC——紫书| 例题7-3 Fractions Again?! (UVA - 10976)_时间复杂度O(n)