Submission #1098945

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

Compilation message

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);
      |                                ^~~~