Guest User

Untitled

a guest
Feb 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. package main;
  2.  
  3. import java.io.File;
  4. import java.util.Scanner;
  5.  
  6. public class Fake {
  7.  
  8. public static void main(String[] args) throws Throwable {
  9. File file = new File("txt");
  10. Scanner scan = new Scanner(file);
  11. int N, M, c;
  12. while (true) {
  13. N = scan.nextInt();
  14. M = scan.nextInt();
  15. if ((N < 1 || N >= 1000) || (M < 1 || M >= 1000))
  16. break;
  17. int num[] = new int[N];
  18. for (int i = 0; i < M; i++)
  19. num[scan.nextInt() - 1]++;
  20. c = 0;
  21. for (int i = 0; i < N; i++)
  22. if (num[i] > 1)
  23. c++;
  24. System.out.println(c);
  25. }
  26. }
  27. }
Add Comment
Please, Sign In to add comment