HDU5858 Hard problem
来源:互联网 发布:淘宝注册页面html模板 编辑:程序博客网 时间:2024/06/15 00:01
Hard problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 647 Accepted Submission(s): 413
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?
![](http://acm.hdu.edu.cn/data/images/C713-1002-1.jpg)
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.
![](http://acm.hdu.edu.cn/data/images/C713-1002-1.jpg)
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 <cstdio>#include <cstring>#include <string>#include <algorithm>#include <map>#include <cmath>#include <set>#include <stack>#include <queue>#include <vector>#include <bitset>#include <functional>using namespace std;#define LL long longconst int INF = 0x3f3f3f3f;const double pi=acos(-1);int main(){ double l; double k=sqrt(2.0); int T; for(scanf("%d",&T); T--;) { scanf("%lf",&l); double x=acos(5.0/(4*k)); double y=acos(-k/4); double z=2*pi-2*y; double w=pi-z; double s4=k*l*l*sin(y)/8; double s3=x*l*l; double s1=s3-2*s4; double s2=w*l*l/8; double s5=pi*l*l/4; printf("%.2f\n",s5-2*s1-2*s2); } return 0;}
阅读全文
0 0
- hdu5858 Hard problem
- HDU5858 Hard problem
- HDU5858 Hard problem
- HDU5858-Hard problem
- hdu5858 Hard problem (计算几何)
- 2016多校训练Contest10: 1002 Hard problem hdu5858
- #2016多校训练Contest10: 1002 Hard problem hdu5858
- Hard problem
- HARD PROBLEM
- [第三次训练]Hard problem
- leetcode hard problem summary
- C. NP-Hard Problem
- 706C. Hard problem
- hdu 5858 Hard problem
- hdu 5858 Hard problem
- Codeforces706C. Hard problem
- 【CF706C】Hard problem
- A. NP-Hard Problem
- fragment懒加载时生命周期分析
- Java中泛型 类型擦除
- 彻底卸载MySQL的方法
- ckeditor 学习笔记【3】粘贴事件/截图粘贴
- Win32串行通信中文版(Serial Communications In Win32)
- HDU5858 Hard problem
- RabbitMQ--RabbitMQ-C客户端使用说明
- 使用jQuery的一些注意事项总结(持续更新......)
- 数据挖掘流程
- springboot中配置restTemplate及简单使用
- Python入门系列——第1篇
- 计算机网络基础学习
- 谓词的使用(NSPredicate)
- regular expression matching 正则匹配