820B - Mister B and Angle in Polygon

思路:

由于正多边形以某个顶点分成的三角形后以这个点为顶点的角都相等,所以可以确定两个点为相邻点,只要再找一个点就够了。

证明如下

以正八边形为例,正多边形可推广。

如图所示:∠1=∠2=∠3=∠4=∠5=∠6=∠7=∠8。

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mem(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define mp make_pair
const int INF=0x3f3f3f3f;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int n;
double a;
cin>>n>>a; double t=180.0/n; double d=INF;
double ang=;
int ans=;
for(int i=;i<=n;i++)
{
ang+=t;
if(fabs(ang-a)<d)
{
d=fabs(ang-a);
ans=i;
}
}
cout<<<<' '<<<<' '<<ans<<endl;
return ;
}

Codeforces 820B - Mister B and Angle in Polygon的更多相关文章

  1. codeforces820B Mister B and Angle in Polygon 2017-06-28 09:42 123人阅读 评论(0) 收藏

    B. Mister B and Angle in Polygon time limit per test 2 seconds memory limit per test 256 megabytes i ...

  2. 【Codeforces Round #421 (Div. 2) B】Mister B and Angle in Polygon

    [题目链接]:http://codeforces.com/contest/820/problem/B [题意] 给你一个正n边形; 然后让你在这正n边行中选3个点,组成一个角; 找出角的大小和所给的角 ...

  3. Codeforces Round #421 (Div. 2)B. Mister B and Angle in Polygon(模拟+精度控制)

    传送门 题意 给出正n多边形和一个数a,寻找与a最接近的角,输出角编号 分析 找出多边形上所有角,一一比对即可 trick 1.判断的时候注意精度,i.e.x-eps>0 2.double与do ...

  4. CodeForces 820B + 821C

    (点击题目即可查看原题) 820B Mister B and Angle in Polygon  题意:在一个正n边形中,每个顶点按顺序记为1~n,正n边形中任意三点顶点组成一个角,∠x1x2x3,问 ...

  5. codeforces 820A. Mister B and Book Reading 解题报告

    题目链接:http://codeforces.com/problemset/problem/820/A 坑爹题目,坑爹题目,坑爹题目....汗 = =!  后台还110个 test 有个地方需要注意下 ...

  6. codeforces 819B - Mister B and PR Shifts(思维)

    原题链接:http://codeforces.com/problemset/problem/819/B 题意:把一个数列整体往右移k位(大于n位置的数移动到数列前端,循环滚动),定义该数列的“偏差值” ...

  7. CodeForces - 820

    Mister B and Book ReadingCodeForces - 820A 题意:C,V0,V1,A,L..总共有C页书,第一天以V0速度读,每天加A,但是不能超过V1,并且要从前一天的看到 ...

  8. codeforces round 421 div2 补题 CF 820 A-E

    A Mister B and Book Reading  O(n)暴力即可 #include<bits/stdc++.h> using namespace std; typedef lon ...

  9. poj1279 半平面交

    题意:没看懂= = sol:在纸上随便画两下就可以看出,答案即按逆时针方向建立line,求它们的半平面交的面积. 模板题.注意输出答案时输出ans+eps,否则可能会出现结果为-0.00的情况. #i ...

随机推荐

  1. mysql外键使用和事物使用

    mysql外键功能主要是为了保证关联表数据的一致性,主要目的是控制存储在外键表中的数据. 使两张表形成关联,外键只能引用外表中的列的值! 例如: a b 两个表 a表中存有 客户号,客户名称 b表中存 ...

  2. php mysql_connect pmysql_connect区别

    <?php        mysql_pconnect('192.168.75.128', 'root', 'root');        mysql_close();        sleep ...

  3. 187. Repeated DNA Sequences(建立词典,遍历一遍 o(n))

    All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACG ...

  4. Intro to Python for Data Science Learning 2 - List

    List from:https://campus.datacamp.com/courses/intro-to-python-for-data-science/chapter-2-python-list ...

  5. EditPlus 4.3.2583 中文版已经发布

    新的版本提升了括号匹配的性能.请点击页面左上角连接下载.

  6. 2017-2018-2 20165207 实验四《Android开发基础》实验报告

    2017-2018-2 20165207 实验四<Android开发基础>实验报告 检查点1 安装测试Android Studio: 安装Android Studio 安装过程比较艰难,一 ...

  7. Echarts 的 Java 封装类库 转自 https://my.oschina.net/flags/blog/316920

    转自: https://my.oschina.net/flags/blog/316920 Echarts 的 Java 封装类库:http://www.oschina.net/p/echarts-ja ...

  8. Ubuntu系统下查看显卡相关信息

    查看显卡信息 root@ubuntu:/home/ubuntu# lspci |grep -i vga 02:00.0 VGA compatible controller: NVIDIA Corpor ...

  9. C/C++笔记 #035# Makefile

    相关资料: Understanding roles of CMake, make and GCC GCC and Make ( A simple tutorial, teaches u how to ...

  10. Python 自学基础(四)——time模块,random模块,sys模块,os模块,loggin模块,json模块,hashlib模块,configparser模块,pickle模块,正则

    时间模块 import time print(time.time()) # 当前时间戳 # time.sleep(1) # 时间延迟1秒 print(time.clock()) # CPU执行时间 p ...