Examples of nextBigInteger()


Examples of java.util.Scanner.nextBigInteger()

    Scanner cin = new Scanner(System.in);
    int numTestcases = cin.nextInt();
    for (int i = 0; i < numTestcases; i++) {
      BigInteger p = cin.nextBigInteger();
      cin.next(); // Eat '/' character
      BigInteger q = cin.nextBigInteger();
      BigInteger gcd = getGCD(p, q);
      p = p.divide(gcd);
      q = q.divide(gcd);
      System.out.println(p + " / " + q);
    }
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      System.out.println(cin.nextBigInteger()
          .multiply(cin.nextBigInteger()).toString());
    }
    cin.close();
  }
}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      System.out.println(cin.nextBigInteger()
          .multiply(cin.nextBigInteger()).toString());
    }
    cin.close();
  }
}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      BigInteger n = cin.nextBigInteger();
      if (n.compareTo(BigInteger.ZERO) == 0) {
        break;
      }
      BigInteger r = n.mod(BigInteger.valueOf(17));
      if (r.compareTo(BigInteger.ZERO) == 0) {
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int numTestcases = cin.nextInt();
    for (int i = 0; i < numTestcases; i++) {
      System.out.println(cin.nextBigInteger()
          .subtract(cin.nextBigInteger()).toString());
    }
    cin.close();
  }
}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    int numTestcases = cin.nextInt();
    for (int i = 0; i < numTestcases; i++) {
      System.out.println(cin.nextBigInteger()
          .subtract(cin.nextBigInteger()).toString());
    }
    cin.close();
  }
}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      int n = cin.nextInt();
      BigInteger a = cin.nextBigInteger();
      BigInteger power = a;
      BigInteger sum = BigInteger.ZERO;
      for (int i = 1; i <= n; i++) {
        sum = sum.add(BigInteger.valueOf(i).multiply(power));
        power = power.multiply(a);
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

public class Main {
  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      BigInteger a = cin.nextBigInteger();
      String op = cin.next();
      BigInteger b = cin.nextBigInteger();
      if (op.compareTo("/") == 0) {
        System.out.println(a.divide(b));
      } else if (op.compareTo("%") == 0) {
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

  public static void main(String[] args) {
    Scanner cin = new Scanner(System.in);
    while (cin.hasNext()) {
      BigInteger a = cin.nextBigInteger();
      String op = cin.next();
      BigInteger b = cin.nextBigInteger();
      if (op.compareTo("/") == 0) {
        System.out.println(a.divide(b));
      } else if (op.compareTo("%") == 0) {
        System.out.println(a.mod(b));
      }
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

       
        int numbersCount;
        BigInteger result;
        Scanner scanner = new Scanner(System.in);
        numbersCount = scanner.nextInt();
        result = scanner.nextBigInteger();
       
        BigInteger currentNumber;
       
        for (int i = 0; i < numbersCount - 1; i += 1) {
            currentNumber = scanner.nextBigInteger();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.