恶臭数字论证器
2025-02-02 19:10:51
发布于:上海
代码参考“恶臭数字论证器”json文件
#include<bits/stdc++.h>
using namespace std;
void f2(){
cout<<"(1-1)*4514";
}
void zheng(int num){
int cnt=0;
map<int,string>m;
m[1]="11/(45-1)*4";
m[2]="-11+4-5+14";
m[3]="11*(-4)+51-4";
m[4]="-11-4+5+14";
m[5]="11-4*5+14";
m[6]="1-14+5+14";
m[7]="11-4+5-1-4";
m[8]="11-4+5/1-4";
m[9]="11-4+5+1-4";
m[10]="-11/4+51/4";
while (num>0){
cnt++;
int ys=num%10;
if (ys==0){
num/=10;
continue;
}
else{
cout<<"("<<m[ys]<<")";
for (int i=1;i<=cnt-1;i++){
cout<<"*("<<m[10]<<")";
}
}
if (num>10) cout<<"+";
num/=10;
}
}
void fu(int num){
cout<<"(11/(45-1)*4)*(11-4-5+1-4)*(";
num=abs(num);
int cnt=0;
map<int,string>m;
m[1]="11/(45-1)*4";
m[2]="-11+4-5+14";
m[3]="11*(-4)+51-4";
m[4]="-11-4+5+14";
m[5]="11-4*5+14";
m[6]="1-14+5+14";
m[7]="11-4+5-1-4";
m[8]="11-4+5/1-4";
m[9]="11-4+5+1-4";
m[10]="-11/4+51/4";
while (num>0){
cnt++;
int ys=num%10;
if (ys==0){
num/=10;
continue;
}
else{
cout<<"("<<m[ys]<<")";
for (int i=1;i<=cnt-1;i++){
cout<<"*("<<m[10]<<")";
}
}
if (num>10) cout<<"+";
num/=10;
}
cout<<")";
}
void f(int key){
if (key>0){
zheng(key);
}
else if (key<0){
fu(key);
}
else{
f2();
}
}
int main(){
int n;
cin>>n;
cout<<n<<"=";
f(n);
return 0;
}
这里空空如也
有帮助,赞一个