【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

x>=y
=>
$\frac{1}{x}
$\frac{1}{x}=\frac{1}{k}-\frac{1}{y}$
结合两个式子可以得到
y

【代码】

/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
*/ #include <bits/stdc++.h>
using namespace std; int k;
vector <pair<int,int> > v; int main(){
#ifdef LOCAL_DEFINE
freopen("F:\\c++source\\rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
while (cin >> k){
v.clear();
for (int y = k+1;y <= 2*k;y++){
int fenzi = k*y;
int fenmu = y-k;
if (fenzi%fenmu==0){
int x = fenzi/fenmu;
if (x>=y) v.push_back({x,y});
}
}
cout << v.size() << endl;
for (int i = 0;i < (int)v.size();i++){
int x = v[i].first,y = v[i].second;
cout <<"1/"<<k<<" = 1/"<<x<<" + 1/"<<y<<endl;
}
}
return 0;
}

【例题 7-3 UVA - 10976】Fractions Again?!的更多相关文章

  1. 暴力枚举 UVA 10976 Fractions Again?!

    题目传送门 /* x>=y, 1/x <= 1/y, 因此1/k - 1/y <= 1/y, 即y <= 2*k */ #include <cstdio> #inc ...

  2. uva 10976 Fractions Again(简单枚举)

    10976 Fractions Again It is easy to see that for every fraction in the form 1 k (k > 0), we can a ...

  3. Uva 10976 Fractions Again?!

    直接暴力 没技巧 y应该从k+1开始循环,因为不然y-k<0的时候 你相当于(x*y) % (负数) 了. #include <iostream> using namespace s ...

  4. uva 10976 fractions again(水题)——yhx

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAB3gAAAM+CAIAAAB31EfqAAAgAElEQVR4nOzdO7KtPJum69GEpAcVQQ ...

  5. UVA 10976 Fractions Again?!【暴力枚举/注意推导下/分子分母分开保存】

    [题意]:给你一个数k,求所有使得1/k = 1/x + 1/y成立的x≥y的整数对. [分析]:枚举所有在区间[k+1, 2k]上的 y 即可,当 1/k - 1/y 的结果分子为1即为一组解. [ ...

  6. UVA.10986 Fractions Again (经典暴力)

    UVA.10986 Fractions Again (经典暴力) 题意分析 同样只枚举1个,根据条件算出另外一个. 代码总览 #include <iostream> #include &l ...

  7. UVA 725 UVA 10976 简单枚举

    UVA 725 题意:0~9十个数组成两个5位数(或0开头的四位数),要求两数之商等于输入的数据n.abcde/fghij=n. 思路:暴力枚举,枚举fghij的情况算出abcde判断是否符合题目条件 ...

  8. 分数拆分( Fractions Again, UVA 10976)-ACM

    It is easy to see that for every fraction in the form  (k > 0), we can always find two positive i ...

  9. 分数拆分(Fractions Again?!, UVa 10976)

    题目链接:https://vjudge.net/problem/UVA-10976 It is easy to see that for every fraction in the form 1k(k ...

随机推荐

  1. 洛谷 P1885 Moo

    P1885 Moo 题目描述 奶牛Bessie最近在学习字符串操作,它用如下的规则逐一的构造出新的字符串: S(0) = “moo” S(1) = S(0) + “m”+ “ooo” + S(0) = ...

  2. 【Linux环境编程】获取网卡的实时网速

    在windows以下.我们能够看到360或者是qq安全卫士的"安全球".上面显示实时的网速情况.那么在linux里面怎样获取网卡的实时网速?事实上原理非常easy,读取须要获取网速 ...

  3. Uva 10081 Tight words (概率DP)

    Time limit: 3.000 seconds Given is an alphabet {0, 1, ... , k}, 0 <= k <= 9 . We say that a wo ...

  4. ios学习之旅------玩转结构体

    1.全局变量和局部变量 局部变量:     概念:定义函数内部变量     定义格式:变量类型 变量名称;     作用域:从定义那一行開始到所在代码块结束     生命周期:从代码运行到定义的哪一行 ...

  5. Android Developer:内存分析器

    Heap Viewer,Memory Monitor和Allocation Tracker是用来可视化你的app使用内存的补充工具. 使用Memory Monitor Tool来发现是否有不好的内存回 ...

  6. android 图片特效处理之锐化效果

    这篇将讲到图片特效处理的锐化效果.跟前面一样是对像素点进行处理,算法是通用的. 算法原理: 一.简单算法:分别获取当前像素点和八个周围像素点的RGB值,先求出当前像素点的RGB值与八个像素点RGB值的 ...

  7. Codefroces Round #429Div2 (A,B,C)

    A. Generous Kefa time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  8. vue 点击事件阻止冒泡 用stop

    1.使用vue阻止子级元素的click事件冒泡,很简单,用stop.eg: @click.stop='xxx'

  9. Jquery学习总结(1)——Jquery常用代码片段汇总

    1. 禁止右键点击 ? 1 2 3 4 5 $(document).ready(function(){     $(document).bind("contextmenu",fun ...

  10. Spring 实现数据库读写分离(转)

    现在大型的电子商务系统,在数据库层面大都采用读写分离技术,就是一个Master数据库,多个Slave数据库.Master库负责数据更新和实时数据查询,Slave库当然负责非实时数据查询.因为在实际的应 ...