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现在画好了符,他能不能获得最高概率呢?
![](https://i-blog.csdnimg.cn/blog_migrate/e10e75d51478c089cc668904817cadfe.png)
高超的数学天分给予了BugZhu神一般的洞察力,BugZhu还发现当图中阴影部分的面积处在[l,r]之间时,他能够获得最高的概率。BugZhu现在画好了符,他能不能获得最高概率呢?
Input
不超过100组数据
每组数据第一行给出l和r(l,r均在double范围内)。
接下来3行,给出所画三角形三个顶点的坐标xi,yi(|xi|,|yi|<=1000)
每组数据第一行给出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;
}