沉石鱼惊旋 @ 2022-02-26 15:52:37
rt,最后一篇little_gift 的题解排版……建议删除
by zhangyaiwei @ 2022-07-02 14:48:28
惊!
by zhangyaiwei @ 2022-07-02 15:24:19
那么本蒟蒻也来秀一秀
#include<bits/stdc++.h>
using namespace std;
int a,b;
string A,B,C;
string CAN(int a){
string C;
while(a!=0){
C+='0'+a%10;
a/=10;
}
return C;
}
string _CAN(int a){
a=abs(a);
string C;
while(a!=0){
C+='0'+(-(a%10));
a/=10;
}
return C;
}
int main(){
cin>>a>>b;
if(a<0){
A=_CAN(a);
}
else{
A=CAN(a);
}
if(b<0){
B=_CAN(b);
}
else{
B=CAN(b);
}
unsigned int len=max(A.size(),B.size());
unsigned int j=0;
for(unsigned int i=0;i<len;i++){
int ab=j;
if(i<(A.size())){
ab+=(A[i]-'0');
}
if(i<(B.size())){
ab+=(B[i]-'0');
}
j=0;
if(ab>=10){
j=1;
ab-=10;
}
else if(ab<0){
j=-1;
ab+=10;
}
C[i]=('0'+ab);
}
if(j!=0){
cout<<j;
}
bool Zflag=true;
for(int i=len-1;i>-1;i--){
if(Zflag&&C[i]=='0'){
continue;
}
Zflag=false;
cout<<C[i];
}
if(Zflag){
cout<<"0";
}
}
by zhangyaiwei @ 2022-07-02 15:24:39
《高精a+b》
by 10chen01 @ 2022-07-20 11:14:14
官方C++题解骗人的,要用高精度long long做啦
by zhizhi_c @ 2022-08-30 20:31:00
@d2020csr 额……