标签:square

3 10.1 20 10 3.0 20 10 30.5 20.4 19.6
25.0000 9.0000 96.0400
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#include <cmath>
#define eps 1e-8
using namespace std;
const int MAXN = 1e3 + 100;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int>P;
int main()
{
int T;
cin>>T;
while(T--)
{
double d,a,b,ans;
scanf("%lf %lf %lf",&d,&a,&b);
if(a > b) swap(a,b);
double mid = sqrt((double)2) / 2 * d;
if(mid + eps >= a / 2) ans = a * a / 4.0;
else if(mid * 2 < a / 2 + eps) ans = d * d;
else
{
double r = mid * 2.0 - a / 2;
ans = d * d - r * r;
}
printf("%.4lf\n",ans);
}
return 0;
}
标签:square
原文地址:http://blog.csdn.net/zsgg_acm/article/details/45169193