SPOJ
Problem Code : JULKA
This problem has been solved in JAVA due to the problem caused by bigger numbers in the test cases.
import java.util.*;
import java.math.*;
class JULKA
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
for(int i=0; i<10; i++)
{
BigInteger Total = new BigInteger(in.next());
BigInteger K_more = new BigInteger(in.next());
BigInteger X = (Total.add(K_more)).divide(new BigInteger("2"));
BigInteger Y = Total.subtract(X);
System.out.println(X.toString());
System.out.println(Y.toString());
}
}
}
No comments:
Post a Comment