Пример #1
0
 public static void main(String[] args) {
   Scanner in = new Scanner(System.in);
   while (in.hasNextBigInteger()) {
     BigInteger N = in.nextBigInteger();
     if (N.compareTo(BigInteger.ONE) > 0) {
       BigInteger two = new BigInteger("2");
       N = N.multiply(two).subtract(two);
     }
     System.out.println(N);
   }
 }
Пример #2
0
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    boolean blank = false;

    while (scanner.hasNextBigInteger()) {
      if (blank) {
        System.out.println();
      } else {
        blank = true;
      }
      BigInteger a = scanner.nextBigInteger();
      BigInteger b = scanner.nextBigInteger();
      System.out.println(a.gcd(b));
    }
  }