Promi_38

cf 992A

Jan 12th, 2021
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include<bits\stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     long long n;
  8.     scanf("%lld", &n);
  9.    
  10.     long long a[n], i, j, c = 0;
  11.     for(i = 0; i < n; i++) scanf("%lld", &a[i]);
  12.    
  13.     sort(a, a+n);
  14.     //for(i = 0; i < n; i++) printf("%lld ", a[i]);
  15.    
  16.     for(i = 0; i < n; i++)
  17.     {
  18.         if(a[i] != 0 && a[i] != a[i+1]) c++;
  19.     }
  20.     printf("%lld\n", c);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment