?? pku2526.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 + -