houyunjie @ 2024-08-26 19:40:13
#include<bits/stdc++.h>
using namespace std;
string s1,s2;
int a[50000000],b[50000000],c[100000019];
int l;
int main(){
cin >> s1 >> s2;
for(int i = 0;i < s1.size();i++){
a[s1.size () - i - 1] = s1[i] - '0';
}
for(int i = 0;i < s2.size();i++){
b[s2.size () - i - 1] = s2[i] - '0';
}
l = s1.size();
if(s2.size() > l){
l = s2.size();
}
for(int i = 0;i < l;i++){
c[i]=a[i] + b[i];
}
for(int i = 0;i < l;i++){
if(c[i]>=10){
c[i + 1] = c[i + 1] + c[i] / 10;
c[i]%=10;
}
}
if(c[l] != 0){
l++;
}
for(int i = l - 1;i >= 0; i--){
cout<<c[i];
}
return 0;
}
by 12345698pP @ 2024-08-26 19:43:17
@houyunjie 你这太复杂了啊
by C_Boa @ 2024-08-26 19:46:37
@houyunjie 本题有负数,高精过不了
by dream_dad @ 2024-08-26 19:46:40
还是高精度 大佬
by C_Boa @ 2024-08-26 19:48:27
@houyunjie 不要脸的求个互关
by 12345698pP @ 2024-08-26 19:50:13
@C_Boa 6
by 12345698pP @ 2024-08-26 19:51:26
@C_Boa 你是真......
by dream_dad @ 2024-08-26 19:52:25
@houyunjie 建议删掉
洛谷你个傻逼!!!!!!!!!!!
by 12345698pP @ 2024-08-26 19:53:00
@dream_dad 同意
by 12345698pP @ 2024-08-26 19:56:55
此帖该结了
by cff_0102 @ 2024-08-26 20:00:54
有负数