We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Constraints
a and b are non-negative integers and can have maximum 200 digits.
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
BigInteger x = BigInteger.valueOf(0);
BigInteger a = new BigInteger(sc.next());
BigInteger b = new BigInteger(sc.next());
if(a.bitLength() < 200 && b.bitLength() < 200 && x.compareTo(a) < 0 && x.compareTo(b) < 0)
System.out.println(a.add(b));
System.out.println(a.multiply(b));
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java BigInteger
You are viewing a single comment's thread. Return to all comments →
Constraints a and b are non-negative integers and can have maximum 200 digits.
public class Solution {
}