HDU 5858 Hard problem

本文介绍了一个针对小学奥林匹克数学竞赛中的几何问题。问题要求计算给定正方形边长时,特定阴影部分的面积。通过数学公式及算法实现了问题的解决,并给出了代码实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hard problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 192    Accepted Submission(s): 145


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.
 

 

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
 

 

Author
BUPT
 

 

Source
 
 
 
解析:
 
 
 
#include <cstdio>
#include <cmath>

int main()
{
    int t;
    scanf("%d", &t);
    int l;
    while(t--){
        scanf("%d", &l);
        double res = 4*l*l*(1.0/8*asin(sqrt(7.0/8))-0.5*acos(5.0/8*sqrt(2))+sqrt(7)/16);
        printf("%.2f\n", res);
    }
    return 0;
}

  

  

转载于:https://www.cnblogs.com/inmoonlight/p/5788081.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值