wrench786

Lab task - (Array - 3)

Oct 7th, 2021
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define ll long long
  4. #define ull unsigned long long
  5. #define uom unordered_map
  6. #define pb push_back
  7. #define yes cout<<"YES\n"
  8. #define no cout<<"NO\n"
  9.  
  10. #define dot(x) fixed<<setprecision(x)
  11. #define wrench786 ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
  12.  
  13. #define PI (acos(-1.0))
  14. #define eps 0.00001
  15. const int LIMIT = 10000*1;
  16. const int mod = 1000000007;
  17. using namespace std;
  18.  
  19. int arr[LIMIT];
  20.  
  21. int main(){
  22. int n,i=0,maxim=0;
  23. while(cin>>n){
  24. arr[n]++;
  25. if(n>maxim) maxim = n;
  26. }
  27. for(i=1;i<=maxim;i++){
  28. if(arr[i]>1){
  29. cout<<i<<" "<<arr[i]<<endl;
  30. arr[i]=1;
  31. }
  32. }
  33.  
  34. for(i=1;i<=maxim;i++){
  35. if(arr[i]==1) cout<<i<<" ";
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment