#include<iostream>
#include<vector>
#include<teatr.h>
using namespace std;
int main()
{
int x = GetN();
long long i, j, suma = 0;
vector <int> heights;
for(i = 0; i < x; i++)
{
heights.push_back(GetElement(i));
}
for(i = 0; i < heights.size(); i++)
{
for(j = i + 1; j < heights.size(); j++)
{
if(heights[i] > heights[j])
suma += 1;
}
}
cout << suma;
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include<iostream> #include<vector> #include<teatr.h> using namespace std; int main() { int x = GetN(); long long i, j, suma = 0; vector <int> heights; for(i = 0; i < x; i++) { heights.push_back(GetElement(i)); } for(i = 0; i < heights.size(); i++) { for(j = i + 1; j < heights.size(); j++) { if(heights[i] > heights[j]) suma += 1; } } cout << suma; return 0; } |
English