cf--1C
2024-08-26 11:01:10
//Accepted 0 KB 60 ms //给出正多变形上的三个点,求正多形的最小面积 //记三个点之间的距离a,b,c; //由余弦定理得cosA //从而可求出sinA,和正多边形所在外接圆的半径r //设三条边所对的圆心角为:theta1,theta2,theta3 //则正多边形所对的圆心角为gcd(theta1,gcd(theta2,theta3)) //其中gcd(theta1,theta2)为求两个浮点数的最大公约数 //至此我们可以根据正多边形所在外接圆的半径r和圆心角求出正多边形的面积 #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <cmath> #include <algorithm> using namespace std; const double Pi=acos(-1.0); /** * This is a documentation comment block * @authr songt */ struct Point { double x,y; }p[]; double getDis(Point p1,Point p2) { return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y)); } double gcd(double a,double b) { ) return a; ) return b; return gcd(b,fmod(a,b)); } void slove() { ],p[]); ],p[]); ],p[]); *b*c); -cosA*cosA); *sinA); //printf("r=%lf\n",r); *asin(a/(*r)); *asin(b//r); //double thetaC=2*asin(c/2/r); *Pi-thetaA-thetaB; //printf("%lf\n",thetaA+thetaB+thetaC); double theta=gcd(thetaA,gcd(thetaB,thetaC)); //printf("theta=%lf\n",theta); //printf("Pi=%lf\n",Pi); *Pi/theta*r*r/*sin(theta); printf("%.6lf\n",s); } int main() { ].x,&p[].y,&p[].x,&p[].y,&p[].x,&p[].y)!=EOF) slove(); ; }
最新文章
- javascript系列:NaN类型
- 【原】Python 用例:打印一个 Header Box
- ML—随机森林&#183;1
- MapReduce排序输出
- 关于Ruby的一些知识
- PAT (Top Level) Practise 1008 Airline Routes(Tarjan模版题)
- Asp.net Vnext IValueProvider
- POJ_2385_Apple_Catching_(动态规划)
- Restful随笔
- ArcGIS API for JavaScript 4.2学习笔记[20] 使用参数查询要素(油井和地震关系)
- JavaUtil_06_DES加解密工具
- NIO基础篇(三)
- 复盘价值1000万的腾讯云硬盘固件";BUG";
- android一个倾斜的TextView,适用于标签效果
- 洛谷.T21778.过年(线段树 扫描线)
- c#代码混淆
- 学习笔记2—MATLAB的copyfile技巧
- [Python2]介绍关于Uiautomator的watcher使用场景及使用方法
- python 游戏(井字棋)
- RabbitMQ None of the specified endpoints were reachable