Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.io.File;
- import java.util.Scanner;
- public class Fake {
- public static void main(String[] args) throws Throwable {
- File file = new File("txt");
- Scanner scan = new Scanner(file);
- int N, M, c;
- while (true) {
- N = scan.nextInt();
- M = scan.nextInt();
- if ((N < 1 || N >= 1000) || (M < 1 || M >= 1000))
- break;
- int num[] = new int[N];
- for (int i = 0; i < M; i++)
- num[scan.nextInt() - 1]++;
- c = 0;
- for (int i = 0; i < N; i++)
- if (num[i] > 1)
- c++;
- System.out.println(c);
- }
- }
- }
Add Comment
Please, Sign In to add comment