This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
double expectedInversions( int n ) {
return (double)n * (n - 1) / 4;
}
int main() {
int n;
string s;
cin >> s;
n = s.size();
cout << fixed << setprecision( 3 ) << expectedInversions( n / 2 ) + expectedInversions( n - n / 2 );
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |