| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 20203 | taehoon1018 | 초록색 삼각형 (YDX13_green) | C++98 | 2088 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 <iomanip>
using namespace std;
typedef struct coord
{
	double x, y;
};
double area(coord *a, coord *b, coord *c)
{
	double res = 0;
	res += a->x*b->y;
	res += b->x*c->y;
	res += c->x*a->y;
	res -= b->x*a->y;
	res -= c->x*b->y;
	res -= a->x*c->y;
	if (res < 0)
		return -res;
	return res;
}
int main(void)
{
	coord p[2000];
	int N = 0;
	int a = 0, b = 1, c = 2;
	double res = 0;
	cin >> N;
	if (N < 3)
	{
		cout << "0";
		return 0;
	}
	for (int i = 0; i < N; i++)
		cin >> p[i].x >> p[i].y;
	while (a != N - 3)
	{
		res += area(p+a, p+b, p+c);
		if (c == N-1)
		{
			if (b == N - 2)
			{
				if (a == N - 3)
					break;
				else
				{
					a++;
					b = a + 1;
					c = a + 2;
				}
			}
			else
			{
				b++;
				c = b + 1;
			}
		}
		else
			c++;
	}
	res += area(p + a, p + b, p + c);
	res *= 3;
	res /= N;
	res /= N - 1;
	res /= N - 2;
	cout << setprecision(12) << res;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
