【HDOJ5979】Convex(三角函数)
2024-09-30 05:30:54
题意: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 ;
}
最新文章
- VisualStudio自动编码插件(Autocode——devprojects.net)
- Android之全局的dialog的显示
- Eclipse cpp 开发 include路径
- 存储过程往拼接的sql语句中传递日期值
- 关于SWT的线程问题
- 基于.NET平台的分层架构实战(六)——依赖注入机制及IoC的设计与实现[转]
- 使用SharePoint管理中心管理服务
- Android 开场动画
- Android中文API (109) —— SimpleCursorTreeAdapter
- [Swift]LeetCode895. 最大频率栈 | Maximum Frequency Stack
- ssh整合详解
- (转)Linux企业运维人员最常用150个命令汇总
- SSH原理与运用:远程登录
- ppoint的使用
- [LOJ 6031]「雅礼集训 2017 Day1」字符串
- python中的sort方法
- [源码] YoCelsius
- 图论&;动态规划:虚树
- Unity5.X 新版AssetBundle打包控制
- webpack构建多页面react项目(webpack+typescript+react)
热门文章
- 导致实例逐出的五大问题 (文档 ID 1526186.1)
- js 两个数组进行去重处理,返回去重后的数组
- python之数据类型补充
- metasploit-shellcode生成
- bootstrap历练实例:复选框或单选按钮作为输入框组的前缀或后缀
- shell脚本,通过传参求斐波那契数列如(0,1,1,2,3,5,8,13..........)
- java在线聊天项目 swt可视化窗口Design 好友列表窗口
- vue input 判断
- c++:printf和cout那个更好更快些
- Java8特性详解 lambda表达式 Stream【转】