#include <iostream>
#include <map>
using namespace std;
int main()
{
int t=0,n=0,x=0,y=0;
cin >> t;
for (int i = 0; i < t; i++)
{
multimap<int, int> coordinate;//关键字可重复的map
cin >> n;
for (int j = 0; j < n; j++)
{
cin >> x >> y;
coordinate.insert(pair<int, int>(x, y));
}
auto map_it = coordinate.cend();//const_iterator迭代器。这个迭代器是可以自己增加的,但是其所指向的元素是不可以被改变的。
map_it--;
float mid =(float) (coordinate.cbegin()->first + map_it->first) / 2;
map_it = coordinate.cbegin();
int sign = 0;
for (int j = 0; j < n; j++)
sign += (map_it++)->first;
if ((float)sign == mid*n)
cout << "YES\n";
else
cout << "NO\n";
}
system("pause");
return 0;
}
运行结果:
运行结果
网友评论