hdu 5858 Hard problem
来源:互联网 发布:微信mac版 dmg 编辑:程序博客网 时间:2024/05/20 23:57
Hard problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 652 Accepted Submission(s): 416
Problem Description
cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it?
Give you the side length of the square L, you need to calculate the shaded area in the picture.
The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.
Give you the side length of the square L, you need to calculate the shaded area in the picture.
The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.
Input
The first line contains a integer T(1<=T<=10000), means the number of the test case. Each case contains one line with integer l(1<=l<=10000).
Output
For each test case, print one line, the shade area in the picture. The answer is round to two digit.
Sample Input
11
Sample Output
0.29
这道题是个数学题,一开始总想着切割算,结果是要加辅助线再利用三角函数。。。。差点就要用积分去算了。将靠近右边与靠近下边的交点分别与左上角顶点相连。
#include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>#include <queue>#include <vector>#include <cmath>using namespace std;const double N=acos(-1.0);int main(){ double l; int T; cin>>T; while(T--) { cin>>l; double l1,l2,l3,l4; l1=l*sqrt(2.0)/2; l2=l; l3=l/2; double z,z1; z=(l2*l2+l1*l1-l3*l3)/(2*l1*l2); z1=(l1*l1+l3*l3-l2*l2)/(2*l1*l3); double A,B,C; A=acos(z); B=acos(z1); double s1,s2,s3; s1=l2*l2*A/2; s2=l1*l2*(sqrt(1-z*z))/2; C=N-B; s3=l3*l3*C/2; double s; s=4*(s3-(s1-s2)); printf("%.2f\n",s); } return 0;}
阅读全文
0 0
- hdu 5858 Hard problem
- hdu 5858 Hard problem
- HDU 5858 Hard Problem
- hdu 5858 Hard problem
- HDU 5858 Hard problem(几何)
- hdu 5858 Hard problem【计算几何+思维】
- HDU 5858 Hard problem (几何)
- 2016多校10 HDU 5858 Hard problem
- HDU-5858-Hard problem(几何)
- HDU 5858 Hard problem(计算几何)
- HDU 5858 Hard problem(计算几何)
- HDU 5858 Hard problem (公式推导)
- HDU-5858 Hard problem(计算几何)
- 数学题(Hard problem,HDU 5858)
- HDU-5858 Hard problem(数学公式、计算几何)
- A hard Aoshu Problem HDU
- A hard Aoshu Problem HDU
- A hard Aoshu Problem HDU
- 树(树,二叉树,二叉查找树)
- UCI数据集使用
- hihocoder1089
- Sublime Text 3 3126 注册码
- 39. Combination Sum
- hdu 5858 Hard problem
- 给定一个数组,值全是正数,请返回累加和为给定值k的最长子数组长度。
- Eclipse如何修改Web项目的名称
- windows 10 python 2.7和python3.6共存解决方法和pip安装
- python matplotlib库
- hdu 5867 Water problem
- Android 中 byte类型数据大于0x7F时的比较
- invalid header field
- OkHttp源码分析(四)DiskLruCache