GYM 100488 Yet Another Goat in the Garden
来源:互联网 发布:免费行业报告下载知乎 编辑:程序博客网 时间:2024/05/22 00:14
题目链接
题意
迷之题面,没有看懂,所以没做出来….
Find what part of the garden could be absorbed by the black hole in the worst case.
这句话可以看出来,原来出题人是想要我们求百分比。
坑啊/(ㄒoㄒ)/~~
解决
- 余弦定理: cos A=(b²+c²-a²)/2bc
- 海伦公式: p=(a+b+c)/2,S=sqrt(q(q-a)(q-b)(q-c))
#include <algorithm>#include <iostream>#include <cstring>#include <vector>#include <cstdio>#include <string>#include <cmath>#include <queue>#include <set>#include <map>#include <complex>using namespace std;typedef long long ll;typedef long double db;typedef pair<int,int> pii;typedef vector<int> vi;#define de(x) cout << #x << "=" << x << endl#define rep(i,a,b) for(int i=a;i<(b);++i)#define all(x) (x).begin(),(x).end()#define sz(x) (int)(x).size()#define mp make_pair#define pb push_back#define fi first#define se second#define E 1e-6#define INF 0x3f3f3f3fvoid open(){freopen("data.txt","r",stdin);}void out(){freopen("out.txt","w",stdout);}const int N = 101010;const int MOD = 1e9 + 7;const double PI=acos(-1.0);int main(){ int a,b,c,r; scanf("%d%d%d%d",&a,&b,&c,&r); //cos sita double cos1=(b*b+a*a-c*c)/2.0/b/a; double cos2=(b*b+c*c-a*a)/2.0/b/c; double cos3=(a*a+c*c-b*b)/2.0/a/c; //sita double sita1=acos(cos1); double sita2=acos(cos2); double sita3=acos(cos3); //de(sita1/PI*180); //de(sita2/PI*180); //de(sita3/PI*180); //S sita double s1=r*r*((1.0/tan(sita1/2.0)-(PI-(double)sita1)/2.0)); double s2=r*r*((1.0/tan(sita2/2.0)-(PI-(double)sita2)/2.0)); double s3=r*r*((1.0/tan(sita3/2.0)-(PI-(double)sita3)/2.0)); //S triangle double l=(a+b+c)/2.0; double ans=l*(l-a)*(l-b)*(l-c); ans=sqrt(ans); //de(ans); double s=s1+s2+s3; printf("%.12lf",1-s/ans);}
阅读全文
0 0
- GYM 100488 Yet Another Goat in the Garden
- GYM 100488 A. Yet Another Goat in the Garden(计算几何)
- Ural1084. Goat in the Garden
- ural 1084. Goat in the Garden
- ural 1348. Goat in the Garden 2
- ural 1084 Goat in the Garden
- Goat in the Garden (ural 1348)
- ural 1084. Goat in the Garden math
- Ural-1084. Goat in the Garden(计算几何)
- GYM 100694 I.Goat in the Field(水~)
- Yet Another Median Task Gym
- Yet Another Median Task Gym
- URAL 1348 Goat in the Garden 2(点到线段的距离)
- URAL 1348 Goat in the Garden 2计算几何(解题报告)
- sgu 1348 Goat in the Garden 2【点到线段的距离】
- timus 1084. Goat in the Garden URAL 解题报告 计算几何
- timus 1348. Goat in the Garden 2 URAL 点到线段的距离
- URAL Goat in the Garden(圆与矩形求交集面积)
- Java知识:初识集合类
- PHP 正则表达式匹配 preg_match 与 preg_match_all 函数
- Chrome学习笔记(二):UI组件,皮肤引擎 —— 基础设施篇
- Jsp使用<c:forEach>遍历List集合
- ios 安装yasm(转)
- GYM 100488 Yet Another Goat in the Garden
- 纯CSS实现垂直居中的几种方法
- Java从服务器下载文件到本地
- java RedisUtils
- 文本框点击后自带蓝色边框解决办法
- React Native带你实现scrollable-tab-view(完结)
- B
- GDB 基础调试总结
- Eclipse 如何配置 Tomcat