G-Circles

Let d be the diameter of a circle with center c = (a, b). A square has been drawn inside that circle such that its vertices lies at the circle’s circumference. Four circles have been drawn on the square’s sides such that the diameter of each circle is the side of the square, as shown in the figure below.

在这里插入图片描述

Your task is to calculate the shaded area in the figure for a given d. Can you?

Input
The first line contains an integer T (1 ≤ T ≤ 105), in which T is the number of test cases.

Each test case consists of a line containing an three integers a, b, and d ( - 109 ≤ a, b ≤ 109) (1 ≤ d ≤ 109), giving the center and the diameter of a circle.

Output
For each test case, print a single line containing shaded area.

Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Example
Input
1
2 3 8
Output
32

题记:给出圆心,半径,求图中阴影部分面积
先求出四个小圆的半圆面积,再减去大圆面积,最后加上正方形面积,求出阴影面积。

#include <bits/stdc++.h>

using namespace std;

#define ll long long

int t;
ll a, b, d;

int main()
{
    scanf("%d", &t);
    while (t--)
    {
        scanf("%lld%lld%lld", &a, &b, &d);
        printf("%.10f\n", (d * d) * 1.0 / 2);
    }
    return 0;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值