import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws ArithmeticException, NumberFormatException, IOException{
// TODO Auto-generated method stub
int no = 10;
for(int k=0; k<no;k++)
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
String str_1 = br.readLine();
BigInteger t = new BigInteger(str);
BigInteger p = new BigInteger(str_1);
BigInteger div = new BigInteger("2");
BigInteger Kl;
Kl = t.add(p);
Kl = Kl.divide(div);
BigInteger Na;
Na = t.subtract(p);
Na = Na.divide(div);
System.out.println(Kl);
System.out.println(Na);
}
}
}
What is the mistake in this ‘Throws exception’ and if I have to do ‘try catch’ what should I return in ‘catch’ to get AC.
Is there any other efficient input format other than buffered reader and scanner, which I can use in acm.