思路:三角形的圆心角可以整除(2*pi)/n

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<queue>
#include<stack>
#include<algorithm>
using namespace std;
#define clc(a,b) memset(a,b,sizeof(a))
#define inf 0x3f3f3f3f
const int N=;
#define LL long long
const double eps = 1e-;
const double pi = acos(-);
// inline int r(){
// int x=0,f=1;char ch=getchar();
// while(ch>'9'||ch<'0'){if(ch=='-') f=-1;ch=getchar();}
// while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
// return x*f;
// }
struct Point{
double x,y;
Point(double a=,double b=):x(a),y(b){}
}; double angle(Point a,Point b,Point c){
b.x-=a.x,b.y-=a.y;
c.x-=a.x,c.y-=a.y;
return acos((b.x*c.x+b.y*c.y)/(hypot(b.x,b.y)*hypot(c.x,c.y)));
} bool dcmp(double f,int n){
return fabs(f * n - round(f * n)) < eps;
} int main(){
while(){
Point p[];
for(int i=;i<;i++)
if(scanf("%lf%lf",&p[i].x,&p[i].y)!=) return ;
double a=angle(p[],p[],p[])/pi;
double b=angle(p[],p[],p[])/pi;
for(int i=;i<=;i++){
if(dcmp(a,i)&&dcmp(b,i)){
printf("%d\n",i);
break;
}
}
}
return ;
}

HDU 4195 Regular Convex Polygon的更多相关文章

  1. HDU4195 Regular Convex Polygon (正多边形、外接圆)

    题意: 给你正n边形上的三个点,问n最少为多少 思路: 三个点在多边形上,所以三个点的外接圆就是这个正多边形的外接圆,余弦定理求出每个角的弧度值,即该角所对边的圆周角,该边对应的圆心角为圆心角的二倍. ...

  2. HDU 6055 - Regular polygon | 2017 Multi-University Training Contest 2

    /* HDU 6055 - Regular polygon [ 分析,枚举 ] 题意: 给出 x,y 都在 [-100, +100] 范围内的 N 个整点,问组成的正多边形的数目是多少 N <= ...

  3. [LeetCode] Convex Polygon 凸多边形

    Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...

  4. Leetcode: Convex Polygon

    Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...

  5. HOJ 13101 The Triangle Division of the Convex Polygon(数论求卡特兰数(模不为素数))

    The Triangle Division of the Convex Polygon 题意:求 n 凸多边形可以有多少种方法分解成不相交的三角形,最后值模 m. 思路:卡特兰数的例子,只是模 m 让 ...

  6. ACM训练联盟周赛 G. Teemo's convex polygon

    65536K   Teemo is very interested in convex polygon. There is a convex n-sides polygon, and Teemo co ...

  7. 【LeetCode】469. Convex Polygon 解题报告(C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 计算向量夹角 日期 题目地址:https://leet ...

  8. HDU 6055 Regular polygon

    Regular polygon Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  9. 2017ACM暑期多校联合训练 - Team 2 1011 HDU 6055 Regular polygon (数学规律)

    题目链接 **Problem Description On a two-dimensional plane, give you n integer points. Your task is to fi ...

随机推荐

  1. ecshop会员中心增加订单搜索功能

    在user.php中的act=order_list中增加以下程序. $order_sn = isset($_REQUEST['order_sn'])?$_REQUEST['order_sn']:''; ...

  2. Demo学习: CellDraw

    CellDraw 学习TUniStringGrid,为什么有些设置在web模式下无效? case TUniBitBtn(Sender).Tag of : UniStringGrid1.ColWidth ...

  3. 【python】疯了,掉坑里出不来了

    学软件最头疼的事情就是版本换来换去: 各种配置错误,疯了,疯了--

  4. [转]LoadRunner脚本录制常见问题整理

    LoadRunner脚本录制常见问题整理 1.LoadRunner录制脚本时为什么不弹出IE浏览器? 当一台主机上安装多个浏览器时,LoadRunner录制脚本经常遇到不能打开浏览器的情况,可以用下面 ...

  5. 【hibernate】spring+ jpa + hibername 配置过程遇到的问题

    org.springframework.data.jpa.domain.support.AuditingEntityListener Auditing: 审计:查账Hades:Hades是一个开源库, ...

  6. python 统计单词个数

    根据一篇英文文章统计其中单词出现最多的10个单词. # -*- coding: utf-8 -*-import urllib2import refrom collections import Coun ...

  7. U盘、移动硬盘提示格式化的处理

    移动硬盘突然打不开了,一点击就提示要求格式化,这种问题本人亲历,现已解决,千万别格式化,千万别格式化,用系统自带磁盘恢复 CHKDSK命令即可解决此问题 方法/步骤 1.在开始菜单找到“运行”窗口,也 ...

  8. 华为机试题——数组排序,且奇数存在奇数位置,偶数存在偶数位置

    题目要求很简单,就是给你一个数组,对它进行排序,并且排序后,奇数要放在奇数的位置上,偶数要放在偶数的位置上,如果不满足这个规则的话就在数组上填充0 实现代码如下,文中值得注意的一点就是如何判读这个数字 ...

  9. Oracle SQL tuning 步骤

    Oracle SQL tuning 步骤 SQL是的全称是Structured Query Language(结构化查询语言).SQL是一个在80年代中期被使用的工业标准数据库查询语言.不要把SQL语 ...

  10. javascript pattern

    bing:javascript pattern baidu:module pattern javascript高级程序设计 姊妹篇:ajax高级程序设计 http://wenku.baidu.com/ ...