7 条题解
-
0
```#include <stdio.h> #include <iostream> #include <math.h> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; cout<<a<<"/"<<b<<"+"<<c<<"/"<<d<<"="; int y=b*d; int x=a*d+c*b; if (x>y) { cout<<x/y; x=x%y; if(x%y!=0) { cout<<"+"; } } a=x,b=y; while(b) { int t=a%b; a=b; b=t; } if(a!=0) { x=x/a; y=y/a; cout<<x<<"/"<<y<<endl; } }
信息
- ID
- 907
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 386
- 已通过
- 150
- 上传者