Advertisement
Guest User

P2

a guest
May 24th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. import java.io.*;
  2. class Friend
  3. {
  4. public static void main(String args[]) throws IOException
  5. {
  6. BufferedReader br=new BufferedReader(new InputStreamReader (System.in));
  7.  
  8.  
  9. int t=Integer.parseInt(br.readLine());
  10.  
  11. for(int i=0; i<t;i++)
  12. {
  13.  
  14. int n=Integer.parseInt(br.readLine());int f=t;
  15. int b[]=new int[n];
  16. String s[]=new String[n];
  17.  
  18. String str=br.readLine();
  19. s=str.split(" ");
  20. for(int j=0;j<n;j++)
  21. {
  22. b[j]=Integer.parseInt(s[j]);
  23. for(int h=0; h<j;h++)
  24. {
  25. if(b[j]==b[h])
  26. f--;
  27. }
  28. }
  29. System.out.println(f);
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement