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"
#define intt long long
#define pb push_back
#define endl '\n'
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<intt,intt>
#define ld long double
using namespace std;
int i,j;
int main(){
string s;
cin >> s;
int n = s.size();
// int n = 899;
if ( n%2 == 0 ){
cout << setprecision(9) << fixed << 1.0*n/4*(n/2-1) << endl;
}
else{
ld a = (n-1)/4.0, b = (n-1)/2.0;
cout << setprecision(9) << fixed << a*b << endl;
}
// ld res = 0;
// for ( i = 1; i <= (n+1)/2; i++ ) res += 1.0*(i-1)/2;
// for ( ; i <= n; i++ ) res += 1.0*(n-i)/2;
// cout << res << endl;
}
# | 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... |