public void init() {
   Scanner scan = new Scanner(System.in);
   count = scan.nextInt();
   x0 = scan.nextLong();
   y0 = scan.nextLong();
   int result = 0;
   boolean special = false;
   for (int i = 0; i < count; i++) {
     long tempx = scan.nextLong();
     long tempy = scan.nextLong();
     if (tempx == x0 && tempy == y0) {
       special = true;
       continue;
     }
     boolean isDuplicate = false;
     for (int j = 0; j < result; j++) {
       long x1 = xList.get(j);
       long y1 = yList.get(j);
       if ((x1 - x0) * (tempy - y0) == (y1 - y0) * (tempx - x0)) {
         isDuplicate = true;
         break;
       }
     }
     if (!isDuplicate) {
       xList.add(tempx);
       yList.add(tempy);
       result++;
     }
   }
   if (special && result == 0) result = 1;
   System.out.println(result);
   scan.close();
 }
  public static void main(String[] args) {
    int i = 4;
    double d = 4.0;
    String s = "HackerRank ";

    Scanner scan = new Scanner(System.in);

    /* Declare second integer, double, and String variables. */
    int j;
    double e;
    String t;
    /* Read and save an integer, double, and String to your variables.*/
    j = scan.nextInt();
    e = scan.nextDouble();
    scan.nextLine();
    t = scan.nextLine();
    /* Print the sum of both integer variables on a new line. */
    System.out.println(i + j);
    /* Print the sum of the double variables on a new line. */
    System.out.println(d + e);
    /* Concatenate and print the String variables on a new line;
    the 's' variable above should be printed first. */
    System.out.println(s + t);

    scan.close();
  }
  public void init() {
    Scanner scan = new Scanner(System.in);
    n = scan.nextInt();
    m = scan.nextInt();
    for (int i = 0; i < n; i++) {
      String input = scan.next();
      record.add(input);
    }

    for (int i = 0; i < m; i++) {
      String input = scan.next();
      char[] charArray = input.toCharArray();
      boolean isValid = false;
      for (int j = 0; j < charArray.length; j++) {
        char c = charArray[j];
        for (char d = 'a'; d <= 'c'; d = (char) (d + 1)) {
          if (d == c) continue;
          charArray[j] = d;
          if (record.contains(new String(charArray))) {
            isValid = true;
            break;
          }
        }
        charArray[j] = c;
        if (isValid) break;
      }
      if (isValid) System.out.println("YES");
      else System.out.println("NO");
    }
    scan.close();
  }
Beispiel #4
0
  public static void main(String[] args) {
    long start = System.currentTimeMillis();

    while (in.hasNext()) solve();
    out.flush();

    long end = System.currentTimeMillis();
    // trace(end-start + "ms");
    in.close();
    out.close();
  }
Beispiel #5
0
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int T = Integer.parseInt(in.nextLine());

    for (int a = 0; a < T; a++) {

      String PAN = in.nextLine();
      System.out.println(isValidPAN(PAN));
    }

    in.close();
  }
Beispiel #6
0
  public static void main(String[] args) {
    debug = args.length > 0;
    long start = System.nanoTime();

    solve();
    out.flush();

    long end = System.nanoTime();
    dump((end - start) / 1000000 + " ms");
    in.close();
    out.close();
  }
Beispiel #7
0
  public static void main(String[] args) {
    debug = args.length > 0;
    long start = System.currentTimeMillis();

    solve();
    out.flush();

    long end = System.currentTimeMillis();
    dump((end - start) + "ms");
    in.close();
    out.close();
  }
 public static void main(String[] args) {
   Scanner in = new Scanner(System.in);
   int T;
   T = in.nextInt();
   while ((T--) > 0) {
     int n = in.nextInt(), k = in.nextInt();
     int value[] = new int[n];
     for (int i = 0; i < n; i++) {
       value[i] = in.nextInt();
     }
     System.out.println(UKS(value, n, k));
   }
   in.close();
 }
Beispiel #9
0
  public static void main(String args[]) {
    int t;
    Scanner s = new Scanner(System.in);
    t = s.nextInt();

    BigInteger b1 = new BigInteger("0");
    int b2;
    BigInteger b3 = new BigInteger("0");
    BigInteger b4 = new BigInteger("10");
    while (t > 0) {
      b1 = s.nextBigInteger();
      b2 = s.nextInt();
      b3 = b1.pow(b2);
      System.out.println(b3.mod(b4));
      t--;
    }
    s.close();
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.close();

    String s = "";

    for (int i = 0; i < n; i++) {
      s = "";

      for (int j = 0; j < n - i - 1; j++) {
        s += " ";
      }

      for (int k = 0; k < i + 1; k++) {
        s += "#";
      }
      System.out.println(s);
    }
  }