Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("sumaxl.in");
- ofstream fout("sumaxl.out");
- typedef int Huge[101];
- void AtribValue(Huge x,unsigned long y)
- {
- x[0]=0;
- while(y)
- {
- x[0]++;
- x[x[0]]=y%10;
- y/=10;
- }
- }
- void Adunare(Huge x,Huge y)
- {
- int i,t=0;
- if(x[0]<y[0])
- {
- x[0]=y[0];
- }
- for(i=1;i<=x[0];i++,t/=10)
- {
- x[i]=(t+=x[i]+y[i])%10;
- }
- if(t)
- x[++x[0]]=t;
- }
- Huge S,Y;
- int main()
- {
- int y,i;
- fin>>S[0];
- for(i=S[0];i>=1;i--)
- fin>>S[i];
- fin>>y;
- AtribValue(Y,y);
- Adunare(S,Y);
- for(i=S[0];i>=1;i--)
- fout<<S[i];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement