codeforces1C

如今 Berland 马戏竞技场为圆形,古代则是正多边形。科学家发现古代竞技场遗址,仅余三根台柱。已知三根台柱坐标,需找出该竞技场可能的最小面积,还给出了输入输出要求及示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Ancient Berland Circus

 CodeForces - 1C 

如今,Berland 的所有马戏表演都有一个圆形的竞技场,其直径为 13 米,但过去的情况有所不同。

在古代 Berland,马戏表演的竞技场的形状为 (等角) 正多边形,其尺寸和角的度数在各马戏表演中可能各不相同。在竞技场的每个角上,有一根特殊的台柱,并且在不同台柱之间系上绳子用以标识竞技场的各条边。

最近,来自 Berland 的科学家们已经发现了某处古代马戏表演竞技场的遗址。他们只发现了三根台柱,其余的则随时间而损毁。

给定了这三根台柱的坐标。请找出该竞技场可能具有的最小面积。

输入

输入文件包含了三行,它们中的每行包含了一对数字 –– 台柱的坐标。任何方向的坐标,其绝对值均不超过 1000,且给出了小数点后至多 6 位的数字。

输出

输出古代竞技场可能的最小面积。该数值应当精确到小数点后至少 6 位数字。数据确保:最佳多边形的角度数不超过 100 。

示例

输入
0.000000 0.000000
1.000000 1.000000
0.000000 1.000000
输出
1.00000000

sol:这三个点肯定在这个三角形的外接圆上,求出圆心,求出半径,然后余弦定理求出三个圆心角,但是求Gcd很蛋碎,一开始我把eps弄成1e-8,疯狂WA,改成1e-4就过了
#include <bits/stdc++.h>
using namespace std;
typedef int ll;
inline ll read()
{
    ll s=0;
    bool f=0;
    char ch=' ';
    while(!isdigit(ch))
    {
        f|=(ch=='-'); ch=getchar();
    }
    while(isdigit(ch))
    {
        s=(s<<3)+(s<<1)+(ch^48); ch=getchar();
    }
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0)
    {
        putchar('-'); x=-x;
    }
    if(x<10)
    {
        putchar(x+'0'); return;
    }
    write(x/10);
    putchar((x%10)+'0');
    return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('\n')
double ax,ay,bx,by,cx,cy;
const double PI=acos(-1),eps=1e-4;
inline double Sqr(double x)
{
    return x*x;
}
inline double Jis(double x1,double y1,double x2,double y2)
{
    return sqrt(Sqr(x2-x1)+Sqr(y2-y1));
}
inline double Jis2(double x1,double y1,double x2,double y2)
{
    return Sqr(x2-x1)+Sqr(y2-y1);
}
inline double gcd(double x,double y)
{
    while(fabs(x)>eps&&fabs(y)>eps)
    {
        if(x>y) x-=floor(x/y)*y;
        else y-=floor(y/x)*x;
    }
    return x+y;
}
int main()
{
    double Zx,Zy;
    scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&cx,&cy);
    double a=2*(bx-ax),b=2*(by-ay),c=Sqr(bx)+Sqr(by)-Sqr(ax)-Sqr(ay);
    double d=2*(cx-ax),e=2*(cy-ay),f=Sqr(cx)+Sqr(cy)-Sqr(ax)-Sqr(ay);
    Zx=(c*e/b-f)/(a*e/b-d);
    Zy=(c*d/a-f)/(b*d/a-e);
    double r=Jis(ax,ay,Zx,Zy),r2=Jis2(ax,ay,Zx,Zy);
    double ab=Jis(ax,ay,bx,by),ac=Jis(ax,ay,cx,cy),bc=Jis(bx,by,cx,cy);
    double ab2=Jis2(ax,ay,bx,by),ac2=Jis2(ax,ay,cx,cy),bc2=Jis2(bx,by,cx,cy);
    double Ang_ab=2.*acos((ac2+bc2-ab2)/(2.*ac*bc));
    double Ang_ac=2.*acos((ab2+bc2-ac2)/(2.*ab*bc));
    double Ang_bc=2.*acos((ac2+ab2-bc2)/(2.*ac*ab));
    double Ang_Z=gcd(Ang_ac,gcd(Ang_ab,Ang_bc));
    double S=.5*r*r*sin(Ang_Z);
    printf("%.15lf\n",(2.*PI/Ang_Z)*S);
    return 0;
}
/*
input
0.000000 0.000000
1.000000 1.000000
0.000000 1.000000
output
1.00000000

Input
71.756151 7.532275
-48.634784 100.159986
91.778633 158.107739
Output
9991.278665811225

Input
18.716839 40.852752
66.147248 -4.083161
111.083161 43.347248
Output
4268.87997505

Input
88.653021 18.024220
51.942488 -2.527850
76.164701 24.553012
Output
1452.52866331
*/
View Code

 

 

Ps:我afo了,QAQ

 

转载于:https://www.cnblogs.com/gaojunonly1/p/10810223.html

### Codeforces Problem 1332C Explanation The provided references pertain specifically to problem 742B on Codeforces rather than problem 1332C. For an accurate understanding and solution approach for problem 1332C, it's essential to refer directly to its description and constraints. However, based on general knowledge regarding competitive programming problems found on platforms like Codeforces: Problem 1332C typically involves algorithmic challenges that require efficient data structures or algorithms such as dynamic programming, graph theory, greedy algorithms, etc., depending upon the specific nature of the task described within this particular question[^6]. To provide a detailed explanation or demonstration concerning **Codeforces problem 1332C**, one would need direct access to the exact statement associated with this challenge since different tasks demand tailored strategies addressing their unique requirements. For obtaining precise details about problem 1332C including any sample inputs/outputs along with explanations or solutions, visiting the official Codeforces website and navigating to contest number 1332 followed by examining section C is recommended. ```python # Example pseudo-code structure often seen in solving competitive coding questions. def solve_problem_1332C(input_data): # Placeholder function body; actual logic depends heavily on the specifics of problem 1332C. processed_result = process_input(input_data) final_answer = compute_solution(processed_result) return final_answer input_example = "Example Input" print(solve_problem_1332C(input_example)) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值