fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--) {
  9. int temp;
  10. int count=0; int n; int A[100010];
  11. for(int c=0;c<100010;c++)
  12. A[c]=0;
  13. cin>>n;
  14. for(int a=1;a<=n;a++)
  15. {
  16. cin>>temp; A[temp]++;
  17. }
  18. for( int a=1;a<=n;a++)
  19. {
  20. if(A[a]!=0) count++;
  21. }
  22. cout<<count<<"\n"; }
  23. return 0;
  24. }
Success #stdin #stdout 0s 3616KB
stdin
1
4
5 5 6 6
stdout
0