BugZhu抽抽抽!!(已知三角形三点坐标,求外接圆半径及三角面积)

BugZhu抽抽抽!!

                                                                       Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
                                                                                                    Total Submission(s): 695    Accepted Submission(s): 253


Problem Description
当前正火的一款手游阴阳师又出新式神了,BugZhu十分想要获得新出的式神,所以他决定花光所有的积蓄来抽抽抽!BugZhu经过长时间的研究后发现通过画三角外接圆能够提高获得该式神的概率,即如下图所示的图形:



高超的数学天分给予了BugZhu神一般的洞察力,BugZhu还发现当图中阴影部分的面积处在[l,r]之间时,他能够获得最高的概率。BugZhu现在画好了符,他能不能获得最高概率呢?
 

Input
不超过100组数据
每组数据第一行给出l和r(l,r均在double范围内)。
接下来3行,给出所画三角形三个顶点的坐标xi,yi(|xi|,|yi|<=1000)
 

Output
每组数组输出一个YES或NO表示能不能获得最高概率
 

Sample Input
  
  
1 5 0.0000 1.0000 -1.0000 0.0000 1.0000 0.0000 3 5 0.0000 1.0000 -1.0000 0.0000 1.0000 0.0000
 

Sample Output
  
  
YES NO
 


#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <bitset>
#include <stack>
#include <map>
#include <climits>
#include <functional>

using namespace std;

#define LL long long
const int INF=0x3f3f3f3f;

int main()
{
    double l, r;
    double x[3],y[3];
    while(~scanf("%lf %lf",&l,&r))
    {
        for(int i = 0; i < 3; i ++)
            scanf("%lf %lf",&x[i],&y[i]);
        double temp,a,b,c;
        a=sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));
        b=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
        c=sqrt((x[0]-x[2])*(x[0]-x[2])+(y[0]-y[2])*(y[0]-y[2]));
        double p =(0.5)*(a+b+c);
        temp=p*(p-a)*(p-b)*(p-c);
        double S=sqrt(temp);
        double R=(0.25)*(a*b*c)/S;
        double S1=3.1415926*R*R;
        double ans=S1-S;
        if(ans>=l&&ans<=r) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值