Advertisement
Josif_tepe

Untitled

Feb 15th, 2022
1,039
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.    
  11.     int niza[n];
  12.     for(int i = 0; i < n; i++) {
  13.         cin >> niza[i];
  14.     }
  15.     for(int i = 0; i < n; i++) {
  16.         int pogolemi = 0;
  17.         for(int j = i + 1; j < n; j++) {
  18.             if(niza[i] > niza[j]) {
  19.                 pogolemi++;
  20.             }
  21.         }
  22.         cout << pogolemi << endl;
  23.     }
  24.    
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement