1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <bits/stdc++.h>
using namespace std;
int temp=0,liczba[5005];
string a,b;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>a>>b;
int Wa=a.length()-1,Wb=b.length()-1,wsk=0,ostatnia=0;
while(wsk<5005)
{
if(Wa>=0)
temp+=a[Wa]-'0';
if(Wb>=0)
temp+=b[Wb]-'0';
liczba[wsk]=temp%10;
if(liczba[wsk]!=0) ostatnia=wsk;
temp/=10;
wsk++;
Wb--;
Wa--;
}
for(int i=ostatnia; i>=0; i--)
cout<<liczba[i];
return 0;
}
|