⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pku2526.cpp

📁 这是ACM 方面的资料 是PKU的 北京大学的出来的
💻 CPP
字号:
#include <stdio.h>
#include <stdlib.h>

typedef struct point
{
	int x, y;
}Point;

Point p[10001];

int cp(const void *a, const void *b)
{
	Point *aa = (Point *)a;
	Point *bb = (Point *)b;
	if (aa->x != bb->x)
	{
		return aa->x - bb->x;
	}
	return aa->y - bb->y;
}

int main()
{
	int T, N, i, x, y;
	Point tmp, *pp;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d", &N);
		for (i = 0; i < N; i++)
		{
			scanf("%d %d", &p[i].x, &p[i].y);
		}
		qsort(p, N, sizeof(p[0]), cp);
		x = p[0].x + p[N - 1].x;
		y = p[0].y + p[N - 1].y;
		for (i = 1; i < N - 1; i++)
		{
			tmp.x = x - p[i].x;
			tmp.y = y - p[i].y;
			pp = (Point *)bsearch(&tmp, p, N, sizeof(p[0]), cp);
			if (pp == NULL)
			{
				printf("no\n");
				break;
			}
		}
		if (i == N - 1)
		{
			printf("yes\n");
		}
	}
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -