uva
来源:互联网 发布:瑞星防火墙软件 编辑:程序博客网 时间:2024/06/10 06:18
很水的一道题 , 只是忘记 set 数组忘记清空,wa 了
题目清楚,找一条竖线,判断是否对称,输入的时候就找到对称轴的 x 坐标,当然 为了防止除法出错,可以对每点坐标进行 *2 处理
#include<iostream>#include<cstdio>#include<set>#include<map>using namespace std;typedef pair<int, int> point;set<point> a;int n, t;void init() { t = 0; a.clear(); int x, y; scanf("%d", &n); for(int i = 0; i < n; ++i) { scanf("%d%d", &x, &y); t += x; a.insert(point(x*n,y)); } t *= 2; }void solve() { for(set<point>::iterator i = a.begin(); i != a.end(); ++i) { point p = *i; //cout << p.first << "==" << p.second << endl; if(a.find(point(t-p.first, p.second )) == a.end() ) { cout << "NO" << endl; return; } } cout << "YES" << endl;}int main() { int T; scanf("%d", &T); while(T--) { init(); solve(); } return 0;}
1 0
- uva
- UVA
- UVA
- UVA
- uva
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- UVA
- 位置和传感器:位置和地图
- mac+xdebug+phpstorm+mamp+chrome 断点调试
- 行为型模式之命令模式(command)
- STM32 USB2.0协议
- ROS 使用stage进行(LaserScan)激光扫描仿真 51cto
- uva
- 程序设计模式(八) C++ 组合(Composite)模式
- IOS 网络学习系列
- 安装TestNG在eclipse中的插件
- JS正则表达式-登陆注册
- 文件上传到D盘
- Binary Tree Tilt问题及解法
- powerdesigner连接数据库 导出数据 生成PDM文件
- ALSA(高级Linux声音架构):一 简单例子