Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,n,m,d=0,c=1;
  6. vector<int>v,v1;
  7. cin>>t;
  8.  
  9. for(int i=0;i<t;i++){
  10. cin>>m;
  11. v.push_back(m);
  12. }
  13. sort(v.begin(),v.end());
  14.  
  15. cin>>n;
  16.  
  17. for(int j=0;j<t-1;j++){
  18. if(v[j]==v[j+1])c++;
  19.  
  20. else {
  21. if(c==n){
  22. cout<<v[j]<<endl;
  23. d++;
  24. break;
  25.  
  26. }
  27. c=1;
  28. }
  29.  
  30. }
  31. if(d==0)cout<<v[0]<<endl;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement