cf--1C

 1 //Accepted    0 KB    60 ms
 2 //给出正多变形上的三个点,求正多形的最小面积
 3 //记三个点之间的距离a,b,c;
 4 //由余弦定理得cosA
 5 //从而可求出sinA,和正多边形所在外接圆的半径r
 6 //设三条边所对的圆心角为:theta1,theta2,theta3
 7 //则正多边形所对的圆心角为gcd(theta1,gcd(theta2,theta3))
 8 //其中gcd(theta1,theta2)为求两个浮点数的最大公约数
 9 //至此我们可以根据正多边形所在外接圆的半径r和圆心角求出正多边形的面积
10 #include <cstdio>
11 #include <cstring>
12 #include <iostream>
13 #include <queue>
14 #include <cmath>
15 #include <algorithm>
16 using namespace std;
17 const double Pi=acos(-1.0);
18 /**
19   * This is a documentation comment block
20   * @authr songt
21   */
22   struct Point
23   {
24       double x,y;
25   }p[3];
26 double getDis(Point p1,Point p2)
27 {
28     return sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
29 }
30 double gcd(double a,double b)
31 {
32     if (fabs(b)<1e-4) return a;
33     if (fabs(a)<1e-4) return b;
34     return gcd(b,fmod(a,b));
35 }
36 void slove()
37 {
38     double a=getDis(p[1],p[2]);
39     double b=getDis(p[1],p[3]);
40     double c=getDis(p[2],p[3]);
41     double cosA=(b*b+c*c-a*a)/(2*b*c);
42     double sinA=sqrt(1-cosA*cosA);
43     double r=a/(2*sinA);
44     //printf("r=%lf\n",r);
45     double thetaA=2*asin(a/(2*r));
46     double thetaB=2*asin(b/2/r);
47     //double thetaC=2*asin(c/2/r);
48     double thetaC=2*Pi-thetaA-thetaB;
49     //printf("%lf\n",thetaA+thetaB+thetaC);
50     double theta=gcd(thetaA,gcd(thetaB,thetaC));
51     //printf("theta=%lf\n",theta);
52     //printf("Pi=%lf\n",Pi);
53     double s=2*Pi/theta*r*r/2*sin(theta);
54     printf("%.6lf\n",s);
55 }
56 int main()
57 {
58     while (scanf("%lf%lf%lf%lf%lf%lf",&p[1].x,&p[1].y,&p[2].x,&p[2].y,&p[3].x,&p[3].y)!=EOF)
59     slove();
60     return 0;
61 }

时间: 2024-08-05 02:37:56

cf--1C的相关文章

AES advanced encryption standard 3

This optimized <../aesbench/> AES implementation conforms to FIPS-197. aes.h #ifndef _AES_H #define _AES_H #ifndef uint8 #define uint8 unsigned char #endif #ifndef uint32 #define uint32 unsigned long int #endif typedef struct { uint32 erk[64]; /* en

ansile(2)模块之user

ansible 创建修改用户属性,选项来自官网,如果有出入,已官网为主 参数 是否必需 默认 选项 说明 append no no yes no 如果设置yes,只添加groups,不添加在组列表里 comment no 注释 createhome no yes yes no 除非设置为no,否则家目录在创建的时候将被创建. expires no None 设置用户的过期时间 force no yes no 此选项在使用state=absent时有效,如userder --force gener

微信 {&quot;errcode&quot;:40029,&quot;errmsg&quot;:&quot;invalid code, hints: [ req_id: Cf.y.a0389s108 ]&quot;}

{"errcode":40029,"errmsg":"invalid code, hints: [ req_id: Cf.y.a0389s108 ]"} 问题:微信网页授权后,获取到 openid 了,一刷新又没了 微信网页授权获取到的 code 只能使用一次(5分钟内有效),使用一次后,马上失效. 页面授权跳转成功,根据 code 也换取到 openid 了. 此时刷新页面,并不会再次进行授权,而是直接刷新了一下上一次授权跳转后的链接,带的还是

CEI.Ensight.Gold.v9.2.1c.Linux64.Redhat 1CD

Spaceclaim v2010 SP1 Win64 1CD 3rd.PlanIt.v9.02.002.2470 1CD IsiPlot.v1.3a 1CD SolidEdge ST3 CHS Win32-ISO 1DVD WaterGEMS V8i 08.11.02.31 1CD Cadence MMSim v10.10.204 Linux 3CD EdgeCAM Part Modeler v2011.R1 1CD Profili.v2.28d 1CD HyperMILL v9.0 SP3 f

CF with friends and user&#39;s influence considered on NYC data(updated Aug,11st)

Here is the code link: https://github.com/FassyGit/LightFM_liu/blob/master/U_F1.py I use NYC data as other experimens. The split of the training data was seperated by the timeline, and I have normalised the interaction matrix by replacing the checkin

CF 750

今天CF打的块残废了     就是一废物 A 在24点之前到 直接模拟即可 #include<stdio.h> #include<algorithm> #include<cstring> #include<string> #include<cmath> using namespace std; #define LL long long #define MAXN 1010 #define inf 1000000000.0 int main() {

CF #394 (2) 5/6

Codeforces Round #394 (Div. 2) 总结:有毒的一场比赛.做了三题,结果A被叉,B.C挂综测,还hack失败一发,第一次在CF体会到了-50分的感觉..不知道是不是人品好,比赛时room炸了,然后,unrated.. A  水题,判一下0 0,然后abs(a-b)<=1 B  水题,组个间距比较一下,但一个数的时候要判一下 C  直接暴力上的题 D  也是xjb暴力 题意:给出n,l,r, a[], p[],另有两个数组b[], c[],ci=bi-ai.l<=ai,

一场CF的台前幕后(上)——转

前奏 大约4月份的时候,业界毒瘤pyx噔噔噔跑过来说:“酷爱!我YY了一道题!准备当CF的C” 我当时就被吓傻了."Yet another Chinese round?" “区间取模,区间求和” 感觉这题还不错?不过pyx嫌水了…… 好办!当时我刚刚出完动态仙人掌不久,于是一拍脑袋说:把这个问题出到仙人掌上去! 当然被pyx鄙视了…… 后来一直就没啥动静,直到5月底的CTSC. 试机的时候pyx给我看了套他出的神题……里面有一道题……我不小心读成了下面这个样子: “给定n个m维的模2意

[2016-03-22][CF][69A][Young Physicist]

时间:2016-03-22 19:41:34 星期二 题目编号:[2016-03-22][CF][69A][Young Physicist] 题目大意:判断向量和是否为0 分析:对应坐标相加 遇到的问题:不能用x+y+z来判断是否都为0,除非输入都是正数 #include <cstdio> using namespace std; int main(){ int a,b,c,x,y,z,n; x = y = z = 0; scanf("%d",&n); for(in

ARC下OC对象和CF对象之间的桥接(bridge)

在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环境下编译器不会自动管理CF对象的内存,所以当我们创建了一个CF对象以后就需要我们使用CFRelease将其手动释放,那么CF和OC相互转化的时候该如何管理内存呢?答案就是我们在需要时可以使用__bridge,__bridge_transfer,__bridge_retained,具体介绍和用法如下