ACdream1012:Convex

Problem Description

We have a special convex that all points have the same distance to origin point.

As you know we can get N segments after linking the origin point and the points on the convex. We can also get N angles between each pair of the neighbor segments.

Now give you the data about the angle, please calculate the area of the convex.

Input

There are multiple test cases.

The first line contains two integer N and D indicating the number of the points and their distance to origin. (3 <= N <= 10, 1 <= D <= 10)

The next lines contains N integers indicating the angles. The sum of the N numbers is always 360.

Output

For each test case output one float numbers indicating the area of the convex. The printed values should have 3 digits after the decimal point.

Sample Input

4 1
90 90 90 90
6 1
60 60 60 60 60 60

Sample Output

2.000
2.598

简单几何,正弦定理

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
using namespace std;
const double pi = acos(-1.0);

int main()
{
    int n,i;
    double l,a[50],s;
    while(~scanf("%d%lf",&n,&l))
    {
        for(i = 0;i<n;i++)
        scanf("%lf",&a[i]);
        s = 0;
        for(i = 0;i<n;i++)
        s = s+0.5*l*l*sin(a[i]*pi/180);
        printf("%.3f\n",s);
    }

    return 0;
}



ACdream1012:Convex

时间: 2024-08-03 16:13:38

ACdream1012:Convex的相关文章

Convex optimization 凸优化

zh.wikipedia.org/wiki/凸優化 以下问题都是凸优化问题,或可以通过改变变量而转化为凸优化问题:[5] 最小二乘 线性规划 线性约束的二次规划 半正定规划 Convex function Convex minimization is a subfield of optimization that studies the problem of minimizing convex functions over convex sets. The convexity makes opt

[LeetCode] Convex Polygon 凸多边形

Given a list of points that form a polygon when joined sequentially, find if this polygon is convex (Convex polygon definition). Note: There are at least 3 and at most 10,000 points. Coordinates are in the range -10,000 to 10,000. You may assume the

hunnu11562:The Triangle Division of the Convex Polygon(第n个卡特兰数取模)

Problem description   A convex polygon with n edges can be divided into several triangles by some non-intersect diagonals. We denote d(n) is the number of the different ways to divide the convex polygon. For example,when n is 6,there are 14 different

关于shape_trans (ConnectedRegions, ConvexRegions, &#39;convex&#39;)的作用于对比

* crystal.hdev: extraction of hexagonally shaped crystals via local thresholding and region post-processing* dev_close_window ()dev_update_window ('off')* ***** step: acquire image* ****read_image (Image, 'crystal')get_image_size (Image, Width, Heigh

凸包(Convex Hull)构造算法——Graham扫描法

凸包(Convex Hull) 在图形学中,凸包是一个非常重要的概念.简明的说,在平面中给出N个点,找出一个由其中某些点作为顶点组成的凸多边形,恰好能围住所有的N个点. 这十分像是在一块木板上钉了N个钉子,然后用一根绷紧的橡皮筋它们都圈起来,这根橡皮筋的形状就是所谓的凸包. 计算凸包的一个著名算法是Graham Scan法,它的时间复杂度与所采用的排序算法时间复杂度相同,通常采用线性对数算法,因此为\( O\left(N\mathrm{log}\left(N\right)\right) \).

Deep Learning for Natural Language Processeing : Convex Optimization

效率爆表的一个晚上,只是因为没带手机,可怕! 今天开启新的课程,http://cs224d.stanford.edu/syllabus.html 第一章是凸优化,convex Optimazition 凸集 Convex Set 定义: A set C is convex if, for any x, y ∈ C and θ ∈ R with 0 ≤ θ ≤ 1,θx + (1 ? θ)y ∈ C. 判别方法:如果一个集合C是凸集,则C中任意两个元素连线上的点都属于C 举例:所有的实数空间:实数

Convex Optimizatioin short outline by Stephen Boyd @ chaoxin

老师介绍:Stephen Boyd, 这是他的书网站Convex Optimization http://web.stanford.edu/~boyd/cvxbook/,有pdf和课程. Kown the big picture 模块化,了解概念,会应用到实际问题,就挺好,很多数学很难的. Many questions have no analytical solution Convex not need know the gridient Concave(convex) none thing

hdu 5979 Convex

Convex Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 670    Accepted Submission(s): 438 Problem Description We have a special convex that all points have the same distance to origin point.As y

OpenCV Tutorials &mdash;&mdash; Convex Hull

凸包 找到物体的轮廓之后,再找其凸包   void convexHull(InputArray points, OutputArray hull, bool clockwise=false, bool returnPoints=true ) Parameters: points – Input 2D point set, stored in std::vector or Mat. hull – Output convex hull. It is either an integer vector