# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1098945 | ohad | Boarding Passes (BOI22_passes) | C++14 | 0 ms | 0 KiB |
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 <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <stdio.h>
using namespace std;
typedef long long ll;
int main() {
string a;
cin >> a;
long long size = a.length();
int l = 0;
long double best = size*(size-1)/4;
for (int i = 50000; i < size; i++)
{
long double x = ((size-i) * (size -i-1)) / long double(4);
long double y = (i*(i-1)) / long double(4);
y += x;
if (y + 0.0000001 < best) {
l = i;
best = y;
}
}
cout << fixed << setprecision(6) << best;
}