scj_juruo @ 2022-10-16 20:35:33
rt,代码如下
#include <bits/stdc++.h>
using namespace std;
int t,n1,n2;
char op;
int main()
{
cin>>t;
while(t--)
{
string tmp;
cin>>tmp;
if(tmp[0]>='a'&&tmp[0]<='c')
{
op=tmp[0];
cin>>n1>>n2;
}
else
{
sscanf(tmp.c_str(),"%d",n1);
cin>>n2;
}
string x="";
if(op=='a')
sprintf(x.c_str(),"%d+%d=%d\n",n1,n2,n1+n2);
else if(op=='b')
sprintf(x.c_str(),"%d-%d=%d\n",n1-n2,n1-n2);
else if(op=='c')
sprintf(x.c_str(),"%d*%d=%d\n",n1,n2,n1*n2);
cout<<x<<x.length()<<endl;
}
return 0;
}
by Magus @ 2022-10-16 21:09:21
@scj_juruo 您不会编译一下吗???
by Magus @ 2022-10-16 21:09:59
@scj_juruo 都不测样例,很好奇你的做题方法
by Magus @ 2022-10-16 21:11:27
@scj_juruo 还有我很怀疑你是题解抄的