您的位置:首页 > 其它

HDU 5858 Hard problem (数学推导)

2016-08-18 17:25 337 查看

Hard problem

题目链接:

http://acm.split.hdu.edu.cn/showproblem.php?pid=5858

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.

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

1

1

Sample Output

0.29

Source

2016 Multi-University Training Contest 10

题意:

求阴影面积.

题解:

本渣不会算,只好百度搜图...

(http://f.hiphotos.baidu.com/zhidao/pic/item/83025aafa40f4bfbde8267a0024f78f0f63618f7.jpg)

(http://zhidao.baidu.com/question/571519797?&oldq=1)



代码:

/注释部分的公式也可以/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <vector>
#include <list>
#define LL long long
#define eps 1e-8
#define maxn 110
#define mod 100000007
#define inf 0x3f3f3f3f
#define mid(a,b) ((a+b)>>1)
#define IN freopen("in.txt","r",stdin);
using namespace std;

int main(int argc, char const *argv[])
{
//IN;

int t; cin >> t;
while(t--)
{
double a; scanf("%lf", &a);

//double ans = a*a/4.0 * asin(sqrt(14.0)/4.0);
//ans -= a*a * asin(sqrt(14.0)/8.0);
//ans += a*a * sqrt(7.0) / 8.0;
//ans *= 2.0;

double ans = atan(sqrt(7.0)) / 4.0;
ans -= atan(sqrt(7.0)/5.0);
ans += sqrt(7.0) / 8.0;
ans *= a*a*2.0;

printf("%.2f\n", ans);
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: