链接

按x或y排序,假如有对称点的话,头尾相对。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<vector>
#include<cmath>
#include<queue>
#include<set>
using namespace std;
#define N 100000
#define LL long long
#define INF 0xfffffff
const double eps = 1e-;
const double pi = acos(-1.0);
const double inf = ~0u>>;
struct Point
{
double x,y;
Point(double x=,double y=):x(x),y(y) {}
}p[N];
typedef Point pointt;
pointt operator + (Point a,Point b)
{
return Point(a.x+b.x,a.y+b.y);
}
pointt operator - (Point a,Point b)
{
return Point(a.x-b.x,a.y-b.y);
}
int dcmp(double x)
{
if(fabs(x)<eps) return ;
else return x<?-:;
}
bool cmp(Point a,Point b)
{
if(dcmp(a.x-b.x)==)
return a.y<b.y;
return a.x<b.x;
}
int main()
{
int n,i,j;
while(scanf("%d",&n)&&n)
{
for(i = ; i <= n ;i++)
scanf("%lf%lf",&p[i].x,&p[i].y);
sort(p+,p+n+,cmp);
double tx = (p[].x+p[n].x)/,ty = (p[].y+p[n].y)/;
int flag = ;
for(i = ; i <= n; i++)
{
double x = (p[i].x+p[n-i+].x)/;
double y = (p[i].y+p[n-i+].y)/;
if(dcmp(x-tx)!=||dcmp(y-ty)!=)
{
flag = ;
break;
}
}
if(flag)
printf("V.I.P. should stay at (%.1f,%.1f).\n",tx,ty);
else
printf("This is a dangerous situation!\n");
}
return ;
}

poj1859The Perfect Symmetry的更多相关文章

  1. words

    conscious[英][ˈkɒnʃəs][美][ˈkɑnʃəs]consensus[英][kənˈsensəs][美][kənˈsɛnsəs] scious sensuswaterflood; de ...

  2. go语言通道详解

    https://www.ardanlabs.com/blog/2017/10/the-behavior-of-channels.html Introduction When I started to ...

  3. Swift3.0服务端开发(一) 完整示例概述及Perfect环境搭建与配置(服务端+iOS端)

    本篇博客算是一个开头,接下来会持续更新使用Swift3.0开发服务端相关的博客.当然,我们使用目前使用Swift开发服务端较为成熟的框架Perfect来实现.Perfect框架是加拿大一个创业团队开发 ...

  4. [LeetCode] Valid Perfect Square 检验完全平方数

    Given a positive integer num, write a function which returns True if num is a perfect square else Fa ...

  5. [LeetCode] Perfect Squares 完全平方数

    Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...

  6. C++: Perfect Forwarding

    Link: Rvalue References and Perfect Forwarding in C++0x (https://www.justsoftwaresolutions.co.uk/cpl ...

  7. How to write perfect C code

    Several days ago, I was involved in an argument about choice of C or C++. What I ignored was "l ...

  8. POJ1274 The Perfect Stall[二分图最大匹配]

    The Perfect Stall Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 23911   Accepted: 106 ...

  9. 【leetcode】Perfect Squares (#279)

    Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 1 ...

随机推荐

  1. linkbutton datagrid showdialog 行效果

    protected void DataGrid1_ItemDataBound(object sender, DataGridItemEventArgs e) { ListItemType itemTy ...

  2. mysql btree与hash索引的适用场景和限制

    btree索引: 如果没有特别指明类型,多半说的就是btree索引,它使用btree数据结构来存储数据,大多数mysql引擎都支持这种索引,archive引擎是一个例外,5.1之前这个引擎不支持任何索 ...

  3. [UML]转:浅谈UML的概念和模型之UML九种图

    转自:http://blog.csdn.net/jiuqiyuliang/article/details/8552956 目录: UML的视图 UML的九种图 UML中类间的关系 上文我们介绍了,UM ...

  4. 【转】西门子数控系统中MMC、PCU、NCU、CCU简略介绍

    转载地址:http://cyj221.blog.163.com/blog/static/34194117201093005526170/ 2010-10-30 01:06:09|  分类: 机械制造 ...

  5. 关于IllegalMonitorStateException异常

    关于IllegalMonitorStateException异常: api中的解释  另请参见: Object.notify(), Object.notifyAll(), Object.wait(), ...

  6. PHP之缩略图

    <?php $imagefile="C:\\Users\\Administrator\\Desktop\\2.jpeg"; $imagattr=getimagesize($i ...

  7. php时间函数整理

    PHP中的时间函数有这么些:(1)date用法: date(格式,[时间]);如果没有时间参数,则使用当前时间. 格式是一个字符串,其中以下字符有特殊意义:U 替换成从一个起始时间(好象是1970年1 ...

  8. Python学习笔记-Day2-Python基础之字典操作

    字典的常用操作包括但不限于以下操作: 字典的字典的索引,新增,删除,循环,长度等等 这里将对列表的内置操作方法进行总结归纳,重点是以示例的方式进行展示. 使用type获取创建对象的类 type(dic ...

  9. [Django_1_0]初次见面

    Django 初次见面 文章将写安装和第一次使用时候的操作.文章是照着文档做的,但是以后的内容会有不一样. 安装 pip install django 我这里是使用python3的,也可以使用 pip ...

  10. linux ssh 使用深度解析(key登录详解)

    SSH全称Secure SHell,顾名思义就是非常安全的shell的意思,SSH协议是IETF(Internet Engineering Task Force)的Network Working Gr ...