liuergou @ 2023-10-19 22:32:14
#include <bits/stdc++.h>
using namespace std;
int n;
string itos(int m){
string s;
while(m){
s=char(m%10+'0')+s;
m/=10;
}
return s;
}
int stoi(string s){
int m=0;
for(int i=0;i<s.size();i++){
m=m*10+s[i]-'0';
}
return m;
}
string pin(int a,int b,char c){
string s;
if(c=='a'){
s=itos(a)+'+'+itos(b)+'='+itos(a+b);
}
if(c=='b'){
s=itos(a)+'-'+itos(b)+'='+itos(a-b);
}
if(c=='c'){
s=itos(a)+'*'+itos(b)+'='+itos(a*b);
}
return s;
}
char t='a';
void print(string s){
cout << s << endl << s.size() << endl;
}
int main(){
string s1,s2,s3;
cin >> n;
while(n--){
cin >> s1 >> s2;
if(islower(s1[0])){
cin >> s3;
t=s1[0];
print(pin(stoi(s2),stoi(s3),t));
}
print(pin(stoi(s1),stoi(s2),t));
}
return 0;
}
全部WA