#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,i;
float r;
int p1,p2,p3,p4,p5,p6,p7,p8,p9;
int j[9]={1,2,3,4,5,6,7,8,9};
for (p1=0;p1<=8;p1++)
{
a=j[p1];
for (p2=0;p2<=8;p2++)
{
if(p1=p2) continue;
else b=j[p2];
for (p3=0;p3<=8;p3++)
{
if(p2=p3) continue;
c=j[p3];
for (p4=0;p4<=8;p4++)
{
if(p3=p4) continue;
d=j[p4];
for (p5=0;p5<=8;p5++)
{
if(p4=p5) continue;
e=j[p5];
for (p6=0;p6<=8;p6++)
{
if(p5=p6) continue;
f=j[p6];
for (p7=0;p7<=8;p7++)
{
if(p6=p7) continue;
g=j[p7];
for (p8=0;p8<=8;p8++)
{
if(p7=p8) continue;
h=j[p8];
for (p9=0;p9<=8;p9++)
if(p8=p9) continue;
i=j[p9];
r=a/(b*10+c)+d/(e*10+f)+g/(h*10+i);
if (r==1)
cout<<"the answer is:"<<a<<"/"<<b<<c<<"+"<<d<<"/"<<e<<f<<"+"<<g<<"/"<<h<<i<<"="<<r<<endl;
else {;}
continue;
}}}}}}}}
return 0;
}
题目是1到9的数,不能重复使用,由三个分式相加,结果等于1.分子为一位数,分母为两位数。求三个分式