【HDOJ5979】Convex(三角函数)
题意:n个点在一个半径为R的圆上,给出这n个点顺时针的夹角差值,求这n个点的凸包面积
n<=10,R<=10
思路:S=1/2*sinθ*a*b
角度转弧度再用sin
C++有点小毛病,叫队友改了下
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair
#define N 1100000
#define MOD 1000000007
#define eps 1e-8
#define pi acos(-1) int n;
double L; int read()
{
int v=,f=;
char c=getchar();
while(c<||<c) {if(c=='-') f=-; c=getchar();}
while(<=c&&c<=) v=(v<<)+v+v+c-,c=getchar();
return v*f;
} int main()
{
while(scanf("%d%lf",&n,&L)!=EOF)
{
double ans=;
for(int i = ; i <= n; ++i)
{
double x;
scanf("%lf",&x);
x/=*1.0;
x*=pi*1.0;
ans+=1.0/*L*L*sin(x);
}
printf("%.3lf\n",ans);
}
return ;
}
【HDOJ5979】Convex(三角函数)的更多相关文章
- [LeetCode] Convex Polygon 凸多边形
Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...
- Leetcode: Convex Polygon
Given a list of points that form a polygon when joined sequentially, find if this polygon is convex ...
- low-rank 的相关求解方法 (CODE) Low-Rank Matrix Recovery and Completion via Convex Optimization
(CODE) Low-Rank Matrix Recovery and Completion via Convex Optimization 这个是来自http://blog.sina.com.cn/ ...
- 关于shape_trans (ConnectedRegions, ConvexRegions, 'convex')的作用于对比
* crystal.hdev: extraction of hexagonally shaped crystals via local thresholding and region post-pro ...
- canvas三角函数应用
这个是圆圈旋转的简单案例 var canvas=document.getElementById("canvas"); var cxt=canvas.getContext(" ...
- 论文阅读之 A Convex Optimization Framework for Active Learning
A Convex Optimization Framework for Active Learning Active learning is the problem of progressively ...
- 凸包(Convex Hull)构造算法——Graham扫描法
凸包(Convex Hull) 在图形学中,凸包是一个非常重要的概念.简明的说,在平面中给出N个点,找出一个由其中某些点作为顶点组成的凸多边形,恰好能围住所有的N个点. 这十分像是在一块木板上钉了N个 ...
- 三角函数计算,Cordic 算法入门
[-] 三角函数计算Cordic 算法入门 从二分查找法说起 减少乘法运算 消除乘法运算 三角函数计算,Cordic 算法入门 三角函数的计算是个复杂的主题,有计算机之前,人们通常通过查找三角函数表来 ...
- C#Windows窗体界面设计_01_绘制三角函数_五点作图法
binzhouweichao@163.com Visual Stutio 2010 C#开发环境 五点作图绘制三角函数,以正弦函数为例,选取一个周期[0, 2π]上的五个特殊的点,也就是横坐标0, π ...
随机推荐
- eclipse中增加matplotlib、web应用’和pip框架包
由于python主要应用在Linux下和相关的vc下,对于熟悉eclipse的我来说,这是一个难题,通过在命令行中转pip可以安装python任何信息,具体的插件直接在一下网页中搜索https://p ...
- Spring IOC的Bean对象
---恢复内容开始--- 在Spring IOC模块中Bean是非常重要的.在这里我想给大家讲讲关于Bean对象实例化的三种注入方式: 首先,我先讲一下关于Bean对象属性值的两种注入方式:set注入 ...
- Gym 100342E Minima (暴力,单调队列)
3e7暴力,800ms+过,单调队列维护区间最小值. #include<bits/stdc++.h> using namespace std; typedef long long ll; ...
- Codeforces Round #317 (Div. 2) D Minimization (贪心+dp)
D. Minimization time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- vue 中 $set 的使用
在我们使用vue进行开发的过程中,可能会遇到一种情况:当生成vue实例后,当再次给数据赋值时,有时候并不会自动更新到视图上去: <!DOCTYPE html> <html> & ...
- CeontOS6.5安装php环境
港湾云主机重装操作系统之后xshell无法连接:重启ssh:# service sshd restart -bash: vim: command not found:输入 rpm -qa|grep v ...
- bash编程的信号捕获:
bash编程的信号捕获: kill -l KILL无法捕捉: trap 'COMMAND' SIGNAL, 信号捕捉用于:在中途中止时做一些清理操作. 一. trap捕捉到信号之后,可以 ...
- C++高精度乘法
#include <cstdio> #include <iostream> #include <algorithm> void highPrecision (int ...
- Linux-实现双主模型的nginx的高可用
实现双主模型的ngnix高可用(一) 准备:主机7台 client: 172.18.x.x 调度器:keepalived+nginx 带172.18.x.x/16 网卡 192.168.234.27 ...
- mysql函数总结
MySQL函数 MySQL数据库提供了很多函数包括: 数学函数:字符串函数:日期和时间函数:条件判断函数:系统信息函数:加密函数:格式化函数: 一.数学函数 数学函数主要用于处理数字,包括整型.浮点数 ...