vov44k

Untitled

Dec 11th, 2021 (edited)
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.88 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Noch {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner in = new Scanner(System.in);
  7.         int l = in.nextInt();
  8.         int n = in.nextInt();
  9.         int m = in.nextInt();
  10.         int[] noski = new int[n * 2];
  11.         int[] count = new int[l + 1];
  12.         for (int i = 0; i < noski.length; i++) {
  13.             noski[i] = in.nextInt();
  14.         }
  15.         for (int i = 0; i < noski.length; i = i + 2) {
  16.             for (int j = noski[i]; j <= noski[i + 1]; j++) {
  17.                 count[noski[i]]++; // почему count[noski[i]]? если просто count[j]++
  18.             }
  19.  
  20.         }
  21.  
  22.         int[] tochki = new int[m];
  23.         for (int i = 0; i < m; i++) {
  24.             tochki[i] = in.nextInt();
  25.         }
  26.  
  27.         for (int i = 0; i < m; i++) {
  28.             System.out.println(count[tochki[i]]);
  29.         }
  30.  
  31.     }
  32.  
  33. }
  34.  
Add Comment
Please, Sign In to add comment