Keyboard Free

Keyboard Free

#include <bits/stdc++.h>
#define ll              long long
#define ld              long double
#define pii             pair<int, int>
#define rep(i,a,b)      for(ll  i=a;i<=b;i++)
#define dec(i,a,b)      for(ll  i=a;i>=b;i--)
#define forn(i, n)      for(ll i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long double pi = acosl(-1.0);
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double eps = 1e-6;
const int mod = 998244353;
const int N = 2e3 + 5;

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
    return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int add(int x, int y) {
    return ((x % mod) + (y % mod)) % mod;
}
inline int sub(int x, int y) {
    x -= y;
    return x < 0 ? x += mod : x;
}
inline int mul(int x, int y) {
    return (1ll * (x % mod) * (y % mod)) % mod;
}
inline int inv(int x) {
    return qpow(x, mod - 2);
}
inline int divd(int x, int y) {
    return (1ll * (x % mod) * inv(y)) % mod;
}

ld dis(ld x1,ld y1,ld x2,ld y2)
{
    ld dx=x2-x1,dy=y2-y1;
    return sqrtl(dx*dx+dy*dy);
}
ld k=1024.0;
int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        ld r1,r2,r3;
        cin>>r1>>r2>>r3;
        if (r1 > r2) swap(r1, r2);
        if (r2 > r3) swap(r2, r3);
        if (r1 > r2) swap(r1, r2);
        ld x1=r1,y1=0.0,res=0.0;
        for(ld i=0;i<k;i++)
        {
            ld theta=((i+0.5)/k)*pi;
            ld x2=r2*cosl(theta),y2=r2*sinl(theta);
            ld a=dis(x1,y1,x2,y2);
            ld d=r1*y2/a;
            ld alpha =asinl(d/r3);
            ld epdis=2*r3*(cosl(alpha)+alpha*sinl(alpha))/pi;
            res+=epdis*a/2;
        }
        res/=k;
        cout.setf(ios::fixed);
        cout<<setprecision(1)<<res<<endl;
    }

    return 0;
}

 

posted @ 2020-07-17 00:15  DeaL57  阅读(199)  评论(0编辑  收藏  举报