Advertisement
Josif_tepe

Untitled

Mar 29th, 2021
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include<algorithm>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin>>n;
  9.     int niza[n];
  10.     for(int i=0;i<n;i++)
  11.     {
  12.         cin>>niza[i];
  13.     }
  14.     sort(niza,niza+n);
  15.     int c;
  16.     int brojac=1;
  17.     int br=0;
  18.     for(int i=0;i<n;i++)
  19.     {
  20.         c=niza[i];
  21.         while(c==niza[i])
  22.         {
  23.             brojac++;
  24.             i++;
  25.         }
  26.         i-=1;
  27.         if(brojac>=1)
  28.         {
  29.             br++;
  30.         }
  31.         brojac=0;
  32.     }
  33.     cout<<br;
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement