补充:8+18正常,异常的是18+8,会输出16
by mouhuangzhong @ 2023-05-18 17:04:38
你可以先贴一下你的代码
by VitrelosTia @ 2023-05-18 17:06:46
@[VT_SODC3DC3BSLF](/user/672333) 帮他贴:
```c++
#include<bits/stdc++.h>
using namespace std;
int main(){
string a,b,res="";
cin>>a>>b;
int la=a.size(),lb=b.size();
int d;
for(int i=1;i<=max(la,lb);++i){
int s=(la<i?0:(a[la-i]-'0'))+(lb<i?0:(b[lb-i]-'0')+d);
d=s/10;
s%=10;
res=char(s+'0')+res;
}
if(d!=0){
res=char(d+'0')+res;
}
cout<<res;
return 0;
}
```
~~艹,这是什么优秀算法,代码这么短,%%%~~
by User904032 @ 2023-05-18 17:20:35
数据点没“18+8”的数据而已。。
by __My0217__ @ 2023-05-18 17:21:36
那加上会怎么样?
by djx @ 2023-05-18 18:16:36