1 / 2
Jul 2019

import java.math.BigInteger;
import java.io.*;
public class Main{
public static void main(String args[]){
try{
int t = 10;
while(t>0){
BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );
BigInteger b = new BigInteger( br.readLine() );
BigInteger m = new BigInteger( br.readLine() );
BigInteger kl = BigInteger.ZERO;
kl = b.add(m).divide( new BigInteger(“2”) );
System.out.println(kl);
System.out.println(kl.subtract(m));
t -=1;
}
}catch(Exception e){
return;
}

}

}

I’m getting wa. Please help. Thanks

  • created

    Jul '19
  • last reply

    Jul '19
  • 1

    reply

  • 819

    views

  • 2

    users

  • 3

    links

Did you try running this? When I tested it on ideone, it only gave the result for one test case.

If you get problems, try seeing what exceptions you’re getting, instead of ignoring any that might be happening.

The problem is where you declare the buffered reader.

Suggested Topics

Topic Category Replies Views Activity
Off-topic 1 79 Apr 9

Want to read more? Browse other topics in Off-topic or view latest topics.