Examples of nextBigInteger()


Examples of java.util.Scanner.nextBigInteger()

  myHarness.check(fund, "hasNextBigDecimal()");
  tmpDec = s.nextBigDecimal ();
  myHarness.check(tmpDec, decimals[i], tmpDec + " == " + decimals[i]);
  fund = s.hasNextBigInteger();
  myHarness.check(fund, "hasNextBigInteger()");
  tmpInt = s.nextBigInteger ();
  myHarness.check(tmpInt, integers[i], tmpInt + " == " + integers[i]);
  if (!fund)
    {
      this.myHarness.fail ("\"" + s.next () +
         "\" is neither BigDecimal nor BigInteger");
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

    myHarness.check(s.hasNextInt(16), "hasNextInt(16)");
    myHarness.check(s.nextInt(16), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(16), "hasNextLong(16)");
    myHarness.check(s.nextLong(16), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(16), "hasNextBigInteger(16)");
    myHarness.check(s.nextBigInteger(16), BigInteger.valueOf(5496130961322L),
        "nextBigInteger is 5496130961322");

    s = new Scanner (testStr).useRadix (16);
    myHarness.check(s.radix(), 16, "radix was not set to 16");
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

    myHarness.check(s.hasNextInt(), "hasNextInt()");
    myHarness.check(s.nextInt(), 1329545071, "nextInt is 1329545071");
    myHarness.check(s.hasNextLong(), "hasNextLong()");
    myHarness.check(s.nextLong(), 69540603232238L, "nextLong is 69540603232238");
    myHarness.check(s.hasNextBigInteger(), "hasNextBigInteger()");
    myHarness.check(s.nextBigInteger(), BigInteger.valueOf(5496130961322L),
        "nextBigInteger is 5496130961322");

  }

}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

 
  public static void main(String[] args)
  {
    Scanner in = new Scanner(System.in);
   
    BigInteger N = in.nextBigInteger();
    int k = in.nextInt();
    int cnt = 0;
    while(k != 0)
    {
      if(is_Palindromic(N.toString()))
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(new File("D:/projects/cpp/wikialgo/bigint.txt"));
    List<BigInteger> a = new ArrayList<BigInteger>();
    List<BigInteger> b = new ArrayList<BigInteger>();
    while (sc.hasNext()) {
      a.add(sc.nextBigInteger());
      b.add(sc.nextBigInteger());
    }

    long time = System.currentTimeMillis();
    PrintWriter pw = new PrintWriter("D:/projects/cpp/wikialgo/bigint1.txt");
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

    Scanner sc = new Scanner(new File("D:/projects/cpp/wikialgo/bigint.txt"));
    List<BigInteger> a = new ArrayList<BigInteger>();
    List<BigInteger> b = new ArrayList<BigInteger>();
    while (sc.hasNext()) {
      a.add(sc.nextBigInteger());
      b.add(sc.nextBigInteger());
    }

    long time = System.currentTimeMillis();
    PrintWriter pw = new PrintWriter("D:/projects/cpp/wikialgo/bigint1.txt");
    List<BigInteger> c = new ArrayList<BigInteger>();
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

    Scanner sc = new Scanner(System.in);
    int cases = sc.nextInt();

    for (int i = 0; i < cases; i++) {
      sc.nextLine();
      BigInteger n = sc.nextBigInteger();
      System.out.println("Case #" + (i + 1) + ": " + hazelnuts(n));
    }
  }
}
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

            int lineNums = s.nextInt();
            for (int i = 1; i <= lineNums; i++) {
                int argNums = s.nextInt();
                BigInteger argsSet[] = new BigInteger[argNums];
                for (int j = 0; j < argNums; j++) {
                    argsSet[j] = s.nextBigInteger();
                }
                BigInteger answer = reckon(argsSet);
                o.println("Case #" + i + ": " + answer);
            }
        } finally {
View Full Code Here

Examples of java.util.Scanner.nextBigInteger()

      if (numItems == 0 && numFriends == 0) {
        break;
      }
      BigInteger sum = BigInteger.ZERO;
      for (int i = 0; i < numItems; i++) {
        sum = sum.add(cin.nextBigInteger());
      }
      BigInteger average = sum.divide(BigInteger.valueOf(numFriends));
      String output = "Bill #" + caseId + " costs " + sum.toString()
          + ": each friend should pay " + average.toString();
      System.out.println(output);
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++) {
      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);
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.