Example #1
1
  public static void main(String[] args) throws IOException {
    long T, N, K, N_temp, a;
    Reader.init(System.in);
    T = Reader.nextLong();
    while (T-- > 0) {
      N = Reader.nextLong();
      K = Reader.nextLong();

      /*N_temp=N;
      while(N_temp-->0)
      	a=Reader.nextLong();*/

      System.out.println(sumbincoef(N - 1, K));
    }
  }
Example #2
1
 public static void main(String[] args) throws IOException {
   Reader.init(System.in);
   int n = Reader.nextInt(), m = Reader.nextInt(), x = Reader.nextInt(), y = Reader.nextInt();
   int[] vests = new int[n], solds = new int[m];
   for (int i = 0; i < n; i++) vests[i] = Reader.nextInt();
   for (int i = 0; i < m; i++) solds[i] = Reader.nextInt();
   int p1 = 0, p2 = 0, count = 0;
   StringBuilder out = new StringBuilder();
   while (p1 < n && p2 < m) {
     if (vests[p1] >= solds[p2] - y && vests[p1] <= solds[p2] + x) {
       out.append((p1 + 1) + " " + (p2 + 1) + "\n");
       p1++;
       p2++;
       count++;
     } else if (vests[p1] < solds[p2] - y) {
       p1++;
     } else {
       p2++;
     }
   }
   System.out.println(count + "\n" + out);
 }