#include <iostream>
using namespace std;
#include <string>
int main() {
char c;
int a, b;
while (cin >> a >> c >> b) {
while (a != 1) {
if (b % (a - 1) == 0) {
cout << 1 << '/' << b / (a - 1) << '+';
a = 1;
}
else {
int d = b / a + 1;
cout << 1 << '/' << d << '+';
a = a - (b % a);
b = d * b;
if (b %a == 0) {
b = b / a;
a = 1;
}
}
}
cout << a << '/' << b << endl;
}
//system("pause");
return 0;
}
将真分数分解为埃及分数
最新推荐文章于 2024-03-15 17:35:05 发布