24点算法 3,13,12,13
来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/08/19 10:00:14
24点算法 3,13,12,13
![24点算法 3,13,12,13](/uploads/image/z/17572773-21-3.jpg?t=24%E7%82%B9%E7%AE%97%E6%B3%95+3%2C13%2C12%2C13)
是我自己编的.算法:先生成全排列,在蛮力匹配括号
#include
#include
#include
using namespace std;
char ope[4];
double Cul(double a,double b,int k)
{
if(k==1) return a+b*1.0;
else if(k==2) return a-b*1.0;
else if(k==3) return a*b*1.0;
else if(k==4)
{
if(!b) return 99999999;
else return a*1.0/b;
}
}
char Trans(int a)
{
if(a==1) return '+';
else if(a==2) return '-';
else if(a==3) return '*';
else if(a==4) return '/';
}
int main()
{
printf(" Made by :Micro.C version 1.0\n\n\n");
int number[5];
printf("Input four normal number\n");
while(scanf("%d%d%d%d",&number[1],&number[2],&number[3],&number[4])!=EOF)
{
int i,j1,j2,j3;
bool find=false;
for(i=0;i
#include
#include
#include
using namespace std;
char ope[4];
double Cul(double a,double b,int k)
{
if(k==1) return a+b*1.0;
else if(k==2) return a-b*1.0;
else if(k==3) return a*b*1.0;
else if(k==4)
{
if(!b) return 99999999;
else return a*1.0/b;
}
}
char Trans(int a)
{
if(a==1) return '+';
else if(a==2) return '-';
else if(a==3) return '*';
else if(a==4) return '/';
}
int main()
{
printf(" Made by :Micro.C version 1.0\n\n\n");
int number[5];
printf("Input four normal number\n");
while(scanf("%d%d%d%d",&number[1],&number[2],&number[3],&number[4])!=EOF)
{
int i,j1,j2,j3;
bool find=false;
for(i=0;i