You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
501 B

7 years ago
  1. import java.math.BigInteger;
  2. public class LargeIntegers {
  3. public void oneOfThree( BigInteger a, BigInteger b, BigInteger c ){
  4. BigInteger res;
  5. BigInteger TWO = new BigInteger("2");
  6. if (a.compareTo(b) == 0){
  7. res = a.multiply(b).multiply(c);
  8. }
  9. else {
  10. if (c.mod(TWO).compareTo(BigInteger.ZERO) == 0) {
  11. res = a.min(b);
  12. }
  13. else {
  14. res = a.max(b);
  15. }
  16. }
  17. System.out.println("Output: " + res);
  18. }
  19. }