HDU 5858 Hard problem (2016 多校训练#10 1002)

题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5858

题意:给出下图和正方形边长,求阴影部分面积。

分析:数学题,总之就是割来割去推公式,比赛时是队友打的,拿他代码直接贴了。

具体分析可以看这里。

http://www.zybang.com/question/1301cb472211299680f8d4796e7dc797.html

代码:

#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;
int main()
{
    double PI=acos(-1.0);
    int t;
    scanf("%d",&t);
    while(t--)
    {
        double l;
        scanf("%lf",&l);
        double bac=(4-PI)*l*l;
        double bef=(4-PI)/4*l*l;
        double gae=0.5*(3*l)*l-0.5*2*l*l*sin(acos(0.75))-(PI/4-acos(5*sqrt(2)/8))/(2*PI)*PI*4*l*l-(acos(0.75)+acos(5*sqrt(2)/8)-PI/4)/(2*PI)*PI*l*l;
        printf("%.2f\n",0.5*(bac-bef-2*gae));
    }
}
View Code

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值