【题目链接】:http://codeforces.com/contest/820/problem/B

【题意】



给你一个正n边形;

然后让你在这正n边行中选3个点,组成一个角;

找出角的大小和所给的角最接近的角;

【题解】



同弧所对应的圆周角都是相同的;

而且每个正多边行都能作出一个外接圆;

所以随便选两个相邻的点;然后再选其他

n-2个点中的一个点组成角;

就能覆盖到所有的情况了;

顺序增加角的大小就好(一份一份地加);



【Number Of WA】



0



【反思】



想说是B题;

就没往复杂的地方想了.



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0) typedef pair<int,int> pii;
typedef pair<LL,LL> pll; const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110; int n,c;
double a,d; int main(){
//Open();
Close();
cin >> n >> a;
double t = (n-2)*180/(1.0*n);
t=t/(1.0*(n-2));
double now = t;
int temp = n;
rep1(i,1,n-2){
if (i==1){
c = temp;
d = fabs(now-a);
}else{
double temp1 = fabs(now-a);
if (temp1 < d){
d = temp1;
c = temp;
}
}
temp--;
now+=t;
}
cout << 1 <<' '<<2<<' '<<c<<endl;
return 0;
}

最新文章

  1. dropzonejs中文翻译手册 DropzoneJS是一个提供文件拖拽上传并且提供图片预览的开源类库.
  2. TeamViewer11使用教程
  3. atitit 短信验证码的源码实现&#160;&#160;.docx
  4. JVM的stack和heap,JVM内存模型,垃圾回收策略,分代收集,增量收集
  5. POJ3080Blue Jeans(暴力)
  6. 【 D3.js 高级系列 — 10.0 】 思维导图
  7. ORACLE CLIENT客户端安装步骤详解
  8. uva 10054 The Necklace(欧拉回路)
  9. 用VB把xls转换为xlsx
  10. 词链(link)
  11. Linux巩固记录(1) J2EE开发环境搭建及网络配置
  12. ss-redir 的 iptables 配置(透明代理)
  13. CentOS6.5 [ERROR] /usr/libexec/mysqld: Can&#39;t create/write to file &#39;/var/lib/mysqld/mysqld.pid&#39; (Errcode: 2)
  14. Js基本函数 2017-03-20
  15. WMI测试器
  16. Linux CentOS设置定时重启:crontab
  17. git中误删提交(commit)后,怎么恢复
  18. eclipse安装STS遇到的问题
  19. 笔记:javascript操作iframe内的DOM元素,及调用iframe内的方法
  20. MNI模板和Talairach 模板的对比

热门文章

  1. 为什么同样的数据,俩人生成的obj和bin文件不一样
  2. SQL中的union
  3. jq不懂的地方
  4. [Python随笔]&gt;&gt;range()函数?
  5. HDU-4296 Buildings 贪心 从相邻元素的相对位置开始考虑
  6. django 之数据库模块
  7. Linux系统下安装配置 OpenLDAP + phpLDAPadmin
  8. PHP 变量作用域
  9. 紫书 习题 11-16 UVa 1669(树形dp)
  10. Mysql导入Sql文件时报Error Code: 2013 - Lost connection to MySQL server during query