题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5533

题意:平面图中 有n个点给你每个点的坐标,判断是否能通过某种连线使得这些点所组成的n边形为 正n变形;

很容易发现在一个n变形中,所有的点之间的距离只有n/2种,所以我们只需判断一下这n个点之间的距离是否只有n/2种即可;

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<vector>
#include<queue>
#include<set>
using namespace std;
#define met(a, b) memset(a, b, sizeof(a))
#define N 105
#define INF 0x3f3f3f3f
typedef long long LL; int d[N*N], x[N], y[N]; int main()
{
int T, n;
scanf("%d", &T);
while(T--)
{
met(d, );
int k = ;
scanf("%d", &n);
for(int i=; i<=n; i++)
{
scanf("%d %d", &x[i], &y[i]);
for(int j=; j<i; j++)
{
d[k++] = (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]);
}
}
sort(d, d+k);
int len = unique(d, d+k)-d;
if(len == n/)
printf("YES\n");
else
printf("NO\n");
}
return ;
}

Dancing Stars on Me---hdu5533(判断是否为正多边形)的更多相关文章

  1. Dancing Stars on Me(判断正多边形)

    Dancing Stars on Me Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Ot ...

  2. 2015ACM/ICPC亚洲区长春站 G hdu 5533 Dancing Stars on Me

    Dancing Stars on Me Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Ot ...

  3. hdu 5533 Dancing Stars on Me 水题

    Dancing Stars on Me Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.p ...

  4. hdu 5533 Dancing Stars on Me

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5533 Dancing Stars on Me Time Limit: 2000/1000 MS (Ja ...

  5. HDU 5533/ 2015长春区域 G.Dancing Stars on Me 暴力

    Dancing Stars on Me Problem Description The sky was brushed clean by the wind and the stars were col ...

  6. Dancing Stars on Me

    Dancing Stars on Me Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Ot ...

  7. hdu 5533 Dancing Stars on Me(数学,水)

    Problem Description The sky was brushed clean by the wind and the stars were cold in a black sky. Wh ...

  8. 【2015 ICPC亚洲区域赛长春站 G】Dancing Stars on Me(几何+暴力)

    Problem Description The sky was brushed clean by the wind and the stars were cold in a black sky. Wh ...

  9. HDU 5533 Dancing Stars on Me( 有趣的计算几何 )

    链接:传送门 题意:给出 n 个点,判断能不能构成一个正 n 边形,这 n 个点坐标是整数 思路:这道题关键就在与这 n 个点坐标是正整数!!!可以简单的分析,如果 n != 4,那一定就不能构成正 ...

随机推荐

  1. 浅谈Apache Spark的6个发光点(CSDN)

    Spark是一个基于内存计算的开源集群计算系统,目的是更快速的进行数据分析.Spark由加州伯克利大学AMP实验室Matei为主的小团队使用Scala开发开发,其核心部分的代码只有63个Scala文件 ...

  2. CentOS下搭建使用gitlab 和tortoiseGit使用

    gitlab和github 一样很爽的一个东西 关于gitlab在CentOS下的安装方法地址参考: https://github.com/gitlabhq/gitlab-recipes/tree/m ...

  3. winform学习之-----关于按键操作的一些小知识(如何获取焦点所在的当前控件)20160623

    1.设置整个窗体keydown事件的时候,要设置keyPreview=true; 2.获取当前拥有焦点的控件: 关于这个问题,自己也是纠结死了,在网上搜了好多相关的问题答案,搜出的结果是: //API ...

  4. SSH整合所需的jar包

    Spring3.1+Hibernate3+Struts2的最新整合所需要的jar包 Spring的基本jar包: 1.org.springframework.web-3.1.4.RELEASE.jar ...

  5. SVN组成中trunk,branches and tags功能用法详解

    SVN组成中trunk,branches and tags功能用法详解  我相信初学开发在SVN作为版本管理时,都估计没可能考虑到如何灵活的运用SVN来管理开发代码的版本,下面我就摘录一篇文章来简单说 ...

  6. Linux 随笔1

    使用fork()系统调用产生的子进程对父进程中数据的修改不会影响到父进程,因为fork()采用的是写时复制机制,就是在fork产生的子进程没有修改父进程的值时,父子进程共享同一块内存,包括栈区.当子进 ...

  7. [转].net中的认证(authentication)与授权(authorization)

    本文转自:http://www.cnblogs.com/yjmyzz/archive/2010/08/29/1812038.html 注:这篇文章主要给新手看的,老手们可能会觉得没啥营养,就请绕过吧. ...

  8. /etc/named/named.conf.options中的Options参数

    listen-on port 53 { any; }; 监听在这部主机系统上面的哪个网路介面.预设是监听在localhost,亦即只有本机可以对DNS 服务进行查询,那当然是很不合理啊!所以这里要将大 ...

  9. 超实用PHP函数总结整理

    超实用PHP函数总结整理 2014-12-06    分类:WEB开发.编程开发.首页精华暂无人评论     来源:月光光博客 分享到:更多8 1.PHP加密解密 PHP加密和解密函数可以用来加密一些 ...

  10. 推荐!国外程序员整理的 PHP 资源大全

    推荐!国外程序员整理的 PHP 资源大全 2014/08/02 · PHP, 工具与资源 · 8.5K 阅读 · 1 评论· php 分享到:0 与<YII框架>不得不说的故事—安全篇 R ...