题目链接: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. mysql中INSTR函数的用法

    mysql中INSTR函数的用法 INSTR(字段名, 字符串) 这个函数返回字符串在某一个字段的内容中的位置, 没有找到字符串返回0,否则返回位置(从1开始) SELECT * FROM tblTo ...

  2. Why NHibernate updates DB on commit of read-only transaction

    http://www.zvolkov.com/clog/2009/07/09/why-nhibernate-updates-db-on-commit-of-read-only-transaction/ ...

  3. Struts1与Struts2的12点区别

    Struts1与Struts2的12点区别  1) 在Action实现类方面的对比:Struts 1要求Action类继承一个抽象基类:Struts 1的一个具体问题是使用抽象类编程而不是接口.Str ...

  4. Spark - RDD(弹性分布式数据集)

    org.apache.spark.rddRDDabstract class RDD[T] extends Serializable with Logging A Resilient Distribut ...

  5. MySQL数据库管理常用命令

    参考: http://blog.linuxeye.com/419.html 安装 利用RPM包安装MySQL   设置TCP 3306端口的iptables     root密码管理 设置root用户 ...

  6. 各分支Linux的镜像下载地址

    https://openstack.redhat.com/Image_resources   http://fedoraproject.org/en/get-fedora#clouds   https ...

  7. windows 下安装Yii2 高级版本

    1.  首先安装 Composer 2.  执行  composer global require "fxp/composer-asset-plugin:~1.1.1" 3. 执行 ...

  8. nginx支持flv MP4 扩展nginx_mod_h264_streaming,nginx-rtmp-module-master,yamdi

    ./configure \ --prefix=/usr/local/nginx \ --sbin-path=/usr/local/nginx/sbin/nginx \ --conf-path=/usr ...

  9. DS实验题 Old_Driver UnionFindSet结构

    题目 思路 很典型的并查集问题,朋友A和B要合并到一个统一的集合中,也就是Union(A, B)操作,在Union操作中需要先找到A所属的集合的代表元和B所属集合的代表元,也就是使用Find(A)和F ...

  10. PHP获取某远程网站的服务器时间

    <?php function get_time($server){ $data  = "HEAD / HTTP/1.1\r\n"; $data .= "Host:  ...