#include<bits/stdc++.h>
using namespace std;
#define siz 1000009
long long ar[siz],ar1[siz],ar2[siz];
main()
{
long ts,cs=1;
cin>>ts;
while(ts--)
{
if(cs>1)
cout<<endl;
cs++;
long i,a,k,k1,sum=0,carry=0,k2=0;
cin>>a;
for(i=0;i<a;i++)
{
cin>>ar[i]>>ar1[i];
}
for(i=a-1;i>=0;i--)
{
k=ar[i];
k1=ar1[i];
sum=k+k1+carry;
if(sum>9)
carry=1;
else
carry=0;
ar2[k2++]=(sum%10);
}
if(carry==1)
{
ar2[k2++]=1;
}
for(i=k2-1;i>=0;i--)
cout<<ar2[i];
cout<<endl;
}
}
using namespace std;
#define siz 1000009
long long ar[siz],ar1[siz],ar2[siz];
main()
{
long ts,cs=1;
cin>>ts;
while(ts--)
{
if(cs>1)
cout<<endl;
cs++;
long i,a,k,k1,sum=0,carry=0,k2=0;
cin>>a;
for(i=0;i<a;i++)
{
cin>>ar[i]>>ar1[i];
}
for(i=a-1;i>=0;i--)
{
k=ar[i];
k1=ar1[i];
sum=k+k1+carry;
if(sum>9)
carry=1;
else
carry=0;
ar2[k2++]=(sum%10);
}
if(carry==1)
{
ar2[k2++]=1;
}
for(i=k2-1;i>=0;i--)
cout<<ar2[i];
cout<<endl;
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন