# JULKA:spoj problem

can anyone please tell me what is wrong with this code…it give WA on spoj

#include<bits/stdc++.h>
using namespace std;
int main()
{
int l,m,t,i;
char ta[101],ma[101];
int x[101],y[101];
for(int k=0;k<10;k++)
{
cin>>ta>>ma;
l=strlen(ta);
m=strlen(ma);
int j=m-1,z,t=0;
if((ta[l-1]%2==0 && ma[m-1]%2==0) || (ta[l-1]%2!=0 && ma[m -1]%2!=0))
{
for(i=l-1;i>=0;i–)
{
if(ta[i]<ma[j] && j>=0)
{
x[i]=((ta[i]-48)+10)-(ma[j]-48);
ta[i-1]–;
}
else if(ta[i]>=ma[j] && j>=0)
x[i]=(ta[i]-48)-(ma[j]-48);
else
x[i]=(ta[i]-48);
j–;

``````}
x[l-1]/=2;
j=m-1;
for(i=l-1;i>=0;i--)
{
if(j>=0)
{
z=x[i]+(ma[j]-48)+t;
y[i]=z%10;
t=z/10;
}
else if(j<0)
{
y[i]=x[i]+t;
t=t/10;
}
j--;
}

for(i=0;i<l;i++)
{
cout<<y[i];
}
cout<<"\n";
for(i=0;i<l;i++)
cout<<x[i];
//t--;
``````

//else
}
cout<<"\n";
}
}

You can easily solve this problem in 4 lines by learning Biginteger in c++.

for eg this is how you have to use biginteger in c++

includebits/stdc++.h

includeboost/multiprecision/cpp_int.hpp

namespace mp = boost::multiprecision;

using namespace std;

int main()

{

int t;

``````cin>>t;

while(t--)

{

mp::cpp_int a,b;

cin>>a>>b;

cout << std::__gcd(a,b)<<endl;

}
``````

}