# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1098945 | 2024-10-10T10:58:41 Z | ohad | Boarding Passes (BOI22_passes) | C++14 | 0 ms | 0 KB |
#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; }