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

题意:给出 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. Iterator和for...of

    Iterator和for...of 什么是Iterator ES6中的Map 和 Set ,再加上之前的数组和对象,这样就有了四种数据集合,用户可以组合使用它们,定义自己的数据结构.这时,我们就需要一 ...

  2. BLOB的读写操作

    //BLOB写入操作package zxt.xsfw.action.ceshi; import javax.servlet.http.HttpServletRequest; import javax. ...

  3. 工具-VS CODE安装

    在Linux下的安装 1.下载tar.gz文件包, 2.要注意加一条命令,这样在任何目录下就可以使用code .直接启动应用程序了 1 sudo ln -s /path/to/vscode/Code ...

  4. quick-cocos2dx 之transition.execute()的缓动效果

    注:本文图片来源(http://hosted.zeh.com.br/tweener/docs/en-us/misc/transitions.html. 侵权请告知,即刻删除) 什么是缓动, 缓动(ea ...

  5. An internal error occurred during: &quot;Building workspace&quot;. java.lang.StackOverflowError

    1 错误描写叙述 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveW91MjNoYWk0NQ==/font/5a6L5L2T/fontsize/400/fi ...

  6. 拥抱Mac之码农篇

    拥抱Mac之码农篇 使用Mac大概两年时间.之前用着公司配的一台27寸的iMac.无奈机械硬盘严重拖慢速度,影响工作心情.于是入手Macbook Retina 13.这两年的开发工作所有在Mac上完毕 ...

  7. 2014.08.04,读书,读书笔记-《Matlab概率与数理统计分析》-第1章 MATLAB的数据基础

    第1章 MATLAB数据基础 虽然一直间或使用MATLAB,但从来没有系统的学习过,现在开始也不晚.先对几个重点或者平时忽略的要点做下笔记. %后的所有文字为注释,多条命令可以放在一行,但要用逗号或分 ...

  8. EM无法登录,提示ORA-28001: the password has expired (DBD ERROR: OCISessionBegin)

    --查看数据库目前的口令期限 sys@TESTDB11>select * from dba_profiles where profile = 'DEFAULT' and resource_nam ...

  9. NESTED LOOPS & HASH JOIN & SORT MERGE JOIN

    表连接方式及使用场合 NESTED LOOP 对于被连接的数据子集较小的情况,nested loop连接是个较好的选择.nested loop就是扫描一个表,每读到一条记录,就根据索引去另一个表里面查 ...

  10. 【POJ 2828】Buy Tickets

    [题目链接] http://poj.org/problem?id=2828 [算法] 离线用线段树维护序列即可 [代码] #include <algorithm> #include < ...