IsFrog @ 2024-02-16 22:12:05
#include<bits/stdc++.h>
using namespace std;
int n, ysf;
char a;
string b, c;
int b2, c2;
int cd(int x){
int cnt=0;
if(x<0 || x==0) cnt=1;
while(x!=0){
cnt++;
x/=10;
}
return cnt;
}
int main(){
cin << n;
for(int i=0; i<n; i++){
cout << a << b << c;
if(a=='a') ysf=1;
else if(a=='b') ysf=2;
else if(a=='c') ysf=3;
else if(a=='d') ysf=4;
else{
b=a+b;
}
for(int i=0; i<b.size(); i++) b2=b2*10+b[i]-'0';
for(int i=0; i<c.size(); i++) c2=c2*10+c[i]-'0';
int num=0
if(ysf==1){
cout << b2 << "+" << c2 << "=" << b2+c2 << endl << cd(b2)+cd(c2)+cd(b2+c2)+2 << endl;
}
else if(ysf==2){
cout << b2 << "-" << c2 << "=" << b2-c2 << endl << cd(b2)+cd(c2)+cd(b2-c2)+2 << endl;
}
else if(ysf==3){
cout << b2 << "*" << c2 << "=" << b2*c2 << endl << cd(b2)+cd(c2)+cd(b2*c2)+2 << endl;
}
else{
cout << b2 << "/" << c2 << "=" << b2/c2 << endl << cd(b2)+cd(c2)+cd(b2/c2)+2 << endl;
}
}
return 0;
}
by kimi0705 @ 2024-02-16 22:13:42
#include<bits/stdc++.h>
using namespace std;
int n, ysf;
char a;
string b, c;
int b2, c2;
int cd(int x){
int cnt=0;
if(x<0 || x==0) cnt=1;
while(x!=0){
cnt++;
x/=10;
}
return cnt;
}
int main(){
cin >> n; // ///////
for(int i=0; i<n; i++){
cout << a << b << c;
if(a=='a') ysf=1;
else if(a=='b') ysf=2;
else if(a=='c') ysf=3;
else if(a=='d') ysf=4;
else{
b=a+b;
}
for(int i=0; i<b.size(); i++) b2=b2*10+b[i]-'0';
for(int i=0; i<c.size(); i++) c2=c2*10+c[i]-'0';
int num=0; /////////
if(ysf==1){
cout << b2 << "+" << c2 << "=" << b2+c2 << endl << cd(b2)+cd(c2)+cd(b2+c2)+2 << endl;
}
else if(ysf==2){
cout << b2 << "-" << c2 << "=" << b2-c2 << endl << cd(b2)+cd(c2)+cd(b2-c2)+2 << endl;
}
else if(ysf==3){
cout << b2 << "*" << c2 << "=" << b2*c2 << endl << cd(b2)+cd(c2)+cd(b2*c2)+2 << endl;
}
else{
cout << b2 << "/" << c2 << "=" << b2/c2 << endl << cd(b2)+cd(c2)+cd(b2/c2)+2 << endl;
}
}
return 0;
}
by IsFrog @ 2024-02-18 13:08:35
还是错的,“// /////”什么意思
by IsFrog @ 2024-02-18 13:10:09
@[kimi0705]()
by IsFrog @ 2024-02-18 13:21:27
RE...
#include<bits/stdc++.h>
using namespace std;
int ysf;
char a;
string b, c;
int b2, c2;
int cd(int x){
int cnt=0;
if(x<0 || x==0) cnt=1;
while(x!=0){
cnt++;
x/=10;
}
return cnt;
}
int main(){
int n;
cin >> n;
for(int i=1; i<=n; ++i){
cout << a << b << c;
if(a=='a') ysf=1;
else if(a=='b') ysf=2;
else if(a=='c') ysf=3;
else if(a=='d') ysf=4;
else if(a>='0' && a<='9'){
b=a+b;
}
for(int i=0; i<b.size(); i++) b2=b2*10+b[i]-'0';
for(int i=0; i<c.size(); i++) c2=c2*10+c[i]-'0';
if(ysf==1){
cout << b2 << "+" << c2 << "=" << b2+c2 << endl << cd(b2)+cd(c2)+cd(b2+c2)+2;
}
else if(ysf==2){
cout << b2 << "-" << c2 << "=" << b2-c2 << endl << cd(b2)+cd(c2)+cd(b2-c2)+2;
}
else if(ysf==3){
cout << b2 << "*" << c2 << "=" << b2*c2 << endl << cd(b2)+cd(c2)+cd(b2*c2)+2;
}
else{
cout << b2 << "/" << c2 << "=" << b2/c2 << endl << cd(b2)+cd(c2)+cd(b2/c2)+2;
}
if(i<n) cout << endl;
}
return 0;
}
//wozhendehuixie,REfulenile
by Charles_with_wkc @ 2024-02-19 11:48:33
@lihua_miaowu
@kimi0705
没有除法
by Charles_with_wkc @ 2024-02-19 11:52:25
不一定是3个