题目链接

圆上n个点等距离分布, 求构成的星星的面积。

我们可以求三角形OAB的面积, ∠CAE = 1/2 ∠ COE = PI/n, 那么∠CAO = PI/2n, ∠AOB非常好求, 就是PI/n, 然后AO = r, ∠ABO = PI-∠CAO-∠AOB, 就可以用正弦定理求出任意另外一条边, 然后s = 1/2absinC, 就可以求出来了。

#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <bitset>
using namespace std;
#define pb(x) push_back(x)
#define ll long long
#define mk(x, y) make_pair(x, y)
#define lson l, m, rt<<1
#define mem(a) memset(a, 0, sizeof(a))
#define rson m+1, r, rt<<1|1
#define mem1(a) memset(a, -1, sizeof(a))
#define mem2(a) memset(a, 0x3f, sizeof(a))
#define rep(i, n, a) for(int i = a; i<n; i++)
#define fi first
#define se second
typedef pair<int, int> pll;
const double PI = acos(-1.0);
const double eps = 1e-;
const int mod = 1e9+;
const int inf = ;
const int dir[][] = { {-, }, {, }, {, -}, {, } };
int main()
{
int n, r;
cin>>n>>r;
double ang1 = PI/n/;
double ang2 = PI/n;
double ang3 = PI-ang1-ang2;
double len = sin(ang1)*r/sin(ang3);
double s = 0.5*r*len*sin(ang2);
s = s**n;
printf("%.8f\n", s);
return ;
}

codeforces 630P. Area of a Star的更多相关文章

  1. codeforces D. Area of Two Circles' Intersection 计算几何

    D. Area of Two Circles' Intersection time limit per test 2 seconds memory limit per test 256 megabyt ...

  2. codeforces 600D Area of Two Circles' Intersection

    分相离,内含,想交三种情况讨论一下. 主要是精度和数据范围的问题,首先数据用long double,能用整型判断就不要用浮点型. 题目中所给的坐标,半径是整型的,出现卡浮点判断的情况还是比较少的. 最 ...

  3. Codeforces 835C - Star sky - [二维前缀和]

    题目链接:http://codeforces.com/problemset/problem/835/C 题意: 在天空上划定一个直角坐标系,有 $n$ 颗星星,每颗星星都有坐标 $(x_i,y_i)$ ...

  4. Codeforces Round #427 (Div. 2) Problem C Star sky (Codeforces 835C) - 前缀和

    The Cartesian coordinate system is set in the sky. There you can see n stars, the i-th has coordinat ...

  5. 创建一个接口Shape,其中有抽象方法area,类Circle 、Rectangle实现area方法计算其面积并返回。又有Star实现Shape的area方法,其返回值是0,Star类另有一返回值boolean型方法isStar;在main方法里创建一个Vector,根据随机数的不同向其中加入Shape的不同子类对象(如是1,生成Circle对象;如是2,生成Rectangle对象;如是3,生成S

    题目补充: 创建一个接口Shape,其中有抽象方法area,类Circle .Rectangle实现area方法计算其面积并返回. 又有Star实现Shape的area方法,其返回值是0,Star类另 ...

  6. Maximal Area Quadrilateral CodeForces - 340B || 三点坐标求三角形面积

    Maximal Area Quadrilateral CodeForces - 340B 三点坐标求三角形面积(可以带正负,表示向量/点的不同相对位置): http://www.cnblogs.com ...

  7. CodeForces 835C - Star sky | Codeforces Round #427 (Div. 2)

    s <= c是最骚的,数组在那一维开了10,第八组样例直接爆了- - /* CodeForces 835C - Star sky [ 前缀和,容斥 ] | Codeforces Round #4 ...

  8. Codeforces Round #427 (Div. 2) [ C. Star sky ] [ D. Palindromic characteristics ] [ E. The penguin's game ]

    本来准备好好打一场的,然而无奈腹痛只能带星号参加 (我才不是怕被打爆呢!) PROBLEM C - Star sky 题 OvO http://codeforces.com/contest/835/p ...

  9. Codeforces 340B - Maximal Area Quadrilateral (计算几何)

    Codeforces Round #198 (Div. 2) 题目链接:Maximal Area Quadrilateral Iahub has drawn a set of \(n\) points ...

随机推荐

  1. PHP自学4——通过mail函数将feedback界面用户填写表单信息发送至指定邮箱

    这一讲的内容依旧简单(谁叫PO主水平菜,依旧是个弱鸡ORZ),通过PHP的内置mail函数将一个反馈界面的信息发送到指定邮箱.在Windows平台不能直接需要使用该函数,需要下载一个sendmail并 ...

  2. Apache Tomcat Not Showing in Eclipse Server Runtime Environments

    In my case I needed to install "JST Server Adapters". I am running Eclipse 3.6 Helios RCP ...

  3. Python核心编程读笔 5: python的序列

    第六章 序列:字符串.列表.元组 一.序列 (1)序列类型操作符 seq[ind] 获得下标为 ind 的元素 seq[ind1:ind2] 切片操作 seq * expr 序列重复 expr 次 s ...

  4. mysql——获取所有table名和table字段名。

    获取database所有table名: (参考:http://stackoverflow.com/questions/2780284/how-to-get-all-table-names-from-a ...

  5. 扩展VirtualBox虚拟机磁盘容量

    1. 在cmd命令行下进入VirtualBox的安装目录,使用“VBoxManage list hdds”命令,找到需要修改磁盘容量的虚拟机的img路径或UUID: VirtualBox安装目录> ...

  6. javascript事件小结(事件处理程序方式)--javascript高级程序设计笔记

    1.事件流:描述的是从页面中接收事件的顺序. 2.事件冒泡:IE的事件流叫做事件冒泡,即事件开始从具体的元素(文档中嵌套层次最深的那个节点)接收,然后逐级向上传播到不具体的节点(文档). 3.事件捕获 ...

  7. PHP fopen和fwrite函数实现创建html页面

    思路 用fopen函数和fread函数得到模板,然后用str_replace函数替换模板标签为变量,最后用fwrite函数输出新的HTML页面 index.html模板页面 <!DOCTYPE ...

  8. GoF——组合模式

    组合模式:将对象组合成树形结构以表示“部分-真题”的结构层次.组合模式使得用户对单个对象和组合对象的使用具有一致性. 结构图: using System; using System.Collectio ...

  9. sqlserver 常用函数(转)

    1.字符串函数 : len(expression) 返回给定字符串表达式的字符(而不是字节)个数,其中不包含尾随空格. datalength(Char_expr) 返回字符串包含字符数,但不包含后面的 ...

  10. 走进C标准库(7)——"string.h"中函数的实现memcmp,memcpy,memmove,memset

    我的memcmp: int memcmp(void *buf1, void *buf2, unsigned int count){ int reval; while(count && ...