Submission #1098945

#TimeUsernameProblemLanguageResultExecution timeMemory
1098945ohadBoarding Passes (BOI22_passes)C++14
Compilation error
0 ms0 KiB
#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; }

Compilation message (stderr)

passes.cpp: In function 'int main()':
passes.cpp:17:47: error: expected primary-expression before 'long'
   17 |    long double x = ((size-i) * (size -i-1)) / long double(4);
      |                                               ^~~~
passes.cpp:18:32: error: expected primary-expression before 'long'
   18 |    long double y = (i*(i-1)) / long double(4);
      |                                ^~~~