当前位置:网站首页>Greed issues - Egypt scores
Greed issues - Egypt scores
2022-06-12 13:46:00 【Disobey the law】
Egyptian scores
Derivation process : Code implementation :
#include<iostream>
using namespace std;
int gcd(int x, int y) {
return !y ? x : gcd(y, x % y);
}
void EgyptFraction(int A, int B)
{
cout << A << "/" << B << "=";
do
{
int E = B / A + 1;//C=B/A
A = A * E - B;
B = B * E;
int t = gcd(B, A);//B>A
if (t > 1) A /= t, B /= t;
cout << "1/" << E << "+";
}while(A != 1);
cout << "1/" << B;
}
int main() {
int mol, den;// molecular , The denominator
cin >> mol >> den;
EgyptFraction(mol, den);
return 0;
}
边栏推荐
- Possible solutions to problems after CodeBlocks installation
- Rk3399 platform development series explanation (kernel debugging chapter) 2.50 use of systrace
- Encryptor and client authenticate with each other
- lua 常用内置函数
- 播放器屏幕方向方案
- C#DBHelper_ FactoryDB_ GetConn
- Code debugging - print log output to file
- 安装MySQL时出错,照着下面这个链接,做到cmd就不行了
- C language array and pointer
- [semidrive source code analysis] [x9 chip startup process] 26 - LK of R5 safetyos_ INIT_ LEVEL_ Target phase code flow analysis (TP drvier, audio server initialization)
猜你喜欢
Ffmpeg Learning Guide
当字节跳动在美国输出中国式 996
Web3.0,「激发创造」的时代
Possible solutions to problems after CodeBlocks installation
618进入后半段,苹果占据高端市场,国产手机终于杀价竞争
Introduction to color coding format
[wustctf2020] selfie score query -1
MySQL 查询 limit 1000,10 和 limit 10 速度一样快吗? 深度分页如何破解
【mysql进阶】mysql索引数据结构的演变(四)
Record some settings for visual studio 2019
随机推荐
Use of awlive structures
Codeforces 1637 B. mex and array - reading, violence
Cdeforces 1638 C. inversion graph - simple thinking
1003: align output
import torch_ Geometric first graph network example
Web3.0,「激发创造」的时代
M1 pod install pod lint failure solution
Application of binary search -- finding the square root sqrt of a number
Redis message queue repeated consumption
Cocoapods的相关知识点
NVIDIA Jetson Nano Developer Kit 入门
Top 10 tips for visual studio code on Google
[semidrive source code analysis] [x9 chip startup process] 25 - Introduction to mailbox inter core communication mechanism (code analysis) rpmsg-ipcc RTOS & QNX
AWLive 结构体的使用
1004: character triangle
view的子视图的递归
Formal analysis of Woo Lam protocol with scyther tool
What if the MySQL installation on the apple computer is completed and cannot be found
imagemagick:a gentle introduction to magick++
1414: [17noip popularization group] score