Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Noch {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int l = in.nextInt();
- int n = in.nextInt();
- int m = in.nextInt();
- int[] noski = new int[n * 2];
- int[] count = new int[l + 1];
- for (int i = 0; i < noski.length; i++) {
- noski[i] = in.nextInt();
- }
- for (int i = 0; i < noski.length; i = i + 2) {
- for (int j = noski[i]; j <= noski[i + 1]; j++) {
- count[noski[i]]++; // почему count[noski[i]]? если просто count[j]++
- }
- }
- int[] tochki = new int[m];
- for (int i = 0; i < m; i++) {
- tochki[i] = in.nextInt();
- }
- for (int i = 0; i < m; i++) {
- System.out.println(count[tochki[i]]);
- }
- }
- }
Add Comment
Please, Sign In to add comment