713 - Adding Reversed Numbers

package uvaTry;
//not solve
import java.io.IOException;
import java.math.BigInteger;
import java.util.Scanner;

public class Main713 {

public static void main(String[] args) throws IOException {

BigInteger a,b,c;
int i,n;
String st1,st2,st3;
Scanner sc=new Scanner(System.in);
n= sc.nextInt();
for(i=0;i<n;i++)
{
a=sc.nextBigInteger();
b=sc.nextBigInteger();
st1=a.toString();
st2=b.toString();
st1=new StringBuffer(st1).reverse().toString();
st2=new StringBuffer(st2).reverse().toString();
a=new BigInteger(st1);
b=new BigInteger(st2);
c=a.add(b);

st3=c.toString();
st3=new StringBuffer(st3).reverse().toString();
c=new BigInteger(st3);
System.out.println(c);

}

}

}

SHARE

Amit Ghosh

    Blogger Comment
    Facebook Comment

0 comments :

Post a Comment