# 凑算式

B      DEF

A + --- + ------- = 10

C      GHI

6+8/3+952/714 就是一种解法，

5+3/1+972/486 是另一种解法。

``````#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
using namespace std;
int times=0;
int Judge(char a[])
{
double b1,b2,b3,b4,b5;
b1=a[0]-'0';
b2=a[1]-'0';
b3=a[2]-'0';
b4=(a[3]-'0')*100+(a[4]-'0')*10+(a[5]-'0');
b5=(a[6]-'0')*100+(a[7]-'0')*10+(a[8]-'0');
if((b1+b2/b3+b4/b5)==10)
{
times++;
//cout<<b1<<" "<<b2<<" "<<b3<<" "<<b4<<" "<<b5<<endl;;
}
}
int main(){
char a[10]="123456789";
Judge(a);
while(next_permutation(a,a+9))
{
Judge(a);
}
cout<<times;
}``````

``````#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
using namespace std;
int times=0;
int Judge(char a[])
{
double b1,b2,b3,b4,b5;
b1=a[0]-'0';
b2=a[1]-'0';
b3=a[2]-'0';
b4=(a[3]-'0')*100+(a[4]-'0')*10+(a[5]-'0');
b5=(a[6]-'0')*100+(a[7]-'0')*10+(a[8]-'0');
if((b1+b2/b3+b4/b5)==10)
{
times++;
//cout<<b1<<" "<<b2<<" "<<b3<<" "<<b4<<" "<<b5<<endl;;
}
}
int main(){
char a[10]="123456789";
Judge(a);
while(next_permutation(a,a+9))
{
Judge(a);
}
cout<<times;
}``````