**链接:****传送门 **

题意:给出 n 个点,判断能不能构成一个正 n 边形,这 n 个点坐标是整数

思路:这道题关键就在与这 n 个点坐标是正整数!!!可以简单的分析,如果 n != 4,那一定就不能构成正 n 边形,否则暴力一下找到最小距离,这个最小距离一定是最短边长,暴力查找一下等于这个边长边的个数,如果是 4 个就能构成正 4 边形了

balabala:

  1. 分析 + 暴力出奇迹,出题人还是蛮有趣的!希望能在比赛中get到这些关键点。
  2. A strong man will struggle with the storms of fate.

/*************************************************************************
> File Name: hdu5533.cpp
> Author: WArobot
> Blog: http://www.cnblogs.com/WArobot/
> Created Time: 2017年05月10日 星期三 19时33分30秒
************************************************************************/ #include<bits/stdc++.h>
using namespace std; struct point{
int x,y;
}po[110]; double len[110][110];
int T,n;
double dis(point a,point b){
return (a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y);
}
int main(){
scanf("%d",&T);
while(T--){
memset(len,0,sizeof(len));
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d%d",&po[i].x,&po[i].y);
}
if(n!=4) printf("NO\n");
else{
double min_len = 1e10;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++){
len[i][j] = dis( po[i], po[j] );
min_len = min( min_len , len[i][j] );
}
int cnt = 0;
for(int i=0;i<n;i++)
for(int j=i+1;j<n;j++)
if( len[i][j] == min_len )
cnt++;
if(cnt == 4) printf("YES\n");
else printf("NO\n");
}
}
return 0;
}

HDU 5533 Dancing Stars on Me( 有趣的计算几何 )的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  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 6184 Counting Stars(三元环计数)

    hdu 6184 Counting Stars(三元环计数) 题意: 给一张n个点m条边的无向图,问有多少个\(A-structure\) 其中\(A-structure\)满足\(V=(A,B,C, ...

  8. hdu 5533

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

  9. hdu 5533 正n边形判断 精度处理

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

随机推荐

  1. 佛祖保佑,永不宕机,永无 Bug

    转自:http://top.jobbole.com/17580/ 佛祖保佑,永不宕机,永无 Bug 为何服务器频遭黑客攻击?为何系统频频宕机,别人家系统却稳如泰山,坚如磐石?为何运维人员和系统管理员行 ...

  2. @value 注解获取属性文件中的值

    一.属性文件 db.properties name=jack 二.配置文件 applicationContext.xml <!-- 加载配置文件,该节点只能存在一个,所以用 * ,加载所有属性文 ...

  3. Android Otto调研

    这两天对Otto进行了一个简单的调研,发现官网特别简单差点儿没东西,github上给的sample也不是非常好.网上的技术博客也差点儿千篇一律,我就把自己的心得体会写下来吧,如有缘者看见望其少走弯路. ...

  4. POJ 3050 Hopscotch 水~

    http://poj.org/problem?id=3050 题目大意: 在一个5*5的格子中走,每一个格子有个数值,每次能够往上下左右走一格,问走了5次后得到的6个数的序列一共同拥有多少种?(一開始 ...

  5. Hadoop之文件系统Shell

    概述: 文件系统(FS)Shell包括各种类-Shell的命令.直接和Hadoop分布式文件系统(HDFS)交互,也支持对其它文件系统的支持.比如:本地文件系统FS,HFTP FS,S3 FS,和其它 ...

  6. Redis源代码分析(二十二)--- networking网络协议传输

    上次我仅仅分析了Redis网络部分的代码一部分,今天我把networking的代码实现部分也学习了一遍,netWorking的代码很多其它偏重的是Clientclient的操作.里面addReply( ...

  7. Unity3D摄像机尾随人物

    这里的镜头主要是从人物的背后尾随的. 首先新建一个C#脚本,命名为MyFollow,然后把下面代码粘贴进去.保存: using UnityEngine; using System.Collection ...

  8. java应用集锦9:httpclient4.2.2的几个常用方法,登录之后访问页面问题,下载文件

    转账注明出处:http://renjie120.iteye.com/blog/1727933 在工作中要用到android,然后进行网络请求的时候,打算使用httpClient. 总结一下httpCl ...

  9. Android获取系统时间的多种方法

    Android中获取系统时间有多种方法,可分为Java中Calendar类获取,java.util.date类实现,还有android中Time实现. 现总结如下: 方法一: ? 1 2 3 4 5 ...

  10. php常用知识集锦

    php常用知识集锦 很多位置都有写好的代码,自己做项目的时候可以直接拿来用,而不用自己写,比如现在看到的菜鸟教程. 1.判断是否为空 empty($_POST["name"]) 2 ...