Advertisement
Guest User

wolny kod

a guest
Oct 15th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int n,temp,zlicz[1000000],ile=0;
  5. long long  t[(int)2e4+1];
  6. int main()
  7. {
  8.     cin>>n;
  9.     for(int i=0;i<n;i++){
  10.         cin>>t[i];
  11.         zlicz[t[i]]++;}
  12.     for(int j=n-1;j>0;j--)
  13.         for(int i=0;i<j;i++)
  14.     {
  15.         if(t[i]>t[i+1])
  16.         {
  17.            temp=t[i];
  18.            t[i]=t[i+1];
  19.            t[i+1]=temp;
  20.         }
  21.     }
  22.     for(int i=0;i<(int)2e4+1;i++)
  23.     {
  24.             if(zlicz[i]>0)
  25.                 ile++;
  26.     }
  27. cout<<ile;
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement