Satanic Panic

收录在 u 群漫游记,详见那,这里放代码。

代码

const int N = 310;

inline ll Read() {
	ll x = 0, f = 1;
	char c = getchar();
	while (c != '-' && (c < '0' || c > '9')) c = getchar();
	if (c == '-') f = -f, c = getchar();
	while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
	return x * f;
}

namespace Main {
	int n;
	struct Node {
		double x, y;
	} p[N];
	struct Line {
		int a, b; double theta;
		void newLine (int a, int b) {
			this->a = a, this->b = b;
			this->theta = atan2(p[b].y - p[a].y, p[b].x - p[a].x);
		}
		bool operator < (const Line & a) const {
			return theta < a.theta;
		}
	} l[N * N];
	int m;
	ll f[N][N][6];

	int main () {
		n = Read();
		for (int i = 1; i <= n; i++) {
			scanf ("%lf%lf", &p[i].x, &p[i].y);
		}
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (i != j) l[++m].newLine(i, j);
			}
		}
		sort (l + 1, l + 1 + m);
		for (int i = 1; i <= m; i++) {
			f[l[i].a][l[i].b][1] = 1;
			for (int j = 1; j <= n; j++)
				for (int k = 2; k <= 5; k++) {
					f[j][l[i].b][k] += f[j][l[i].a][k - 1];
				}
		}
		ll ans = 0;
		for (int i = 1; i <= n; i++) ans += f[i][i][5];
		printf ("%lld\n", ans);
		return 0;
	}
}

int main () {
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	Main::main();
	return 0;
}
EOF

评论

暂无评论

发表评论

可以用@mike来提到mike这个用户,mike会被高亮显示。如果你真的想打“@”这个字符,请用“@@”。

博客信息

作者
Jayun
时间
2023-10-12 09:41:23