| 比赛 | 
    20110722 | 
    评测结果 | 
    AWWWWWWWWW | 
    | 题目名称 | 
    饥饿的母牛 | 
    最终得分 | 
    10 | 
    | 用户昵称 | 
    .Xmz | 
    运行时间 | 
    0.000 s  | 
    | 代码语言 | 
    C++ | 
    内存使用 | 
    0.00 MiB  | 
    | 提交时间 | 
    2011-07-22 09:00:17 | 
显示代码纯文本
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
const double Pi=3.14159265;
double ans,L,D,S,j,len;
void solve()
{
	scanf("%lf%lf%lf",&L,&D,&S);
	len=S-sqrt((L/2)*(L/2)+D*D);
	if (S<=D) ans=Pi*S*S;
	else if (len>=0)
	{
		j=atan((L/2)/D);
		ans=len*len*j+S*S*(Pi-j)+Pi*len*len/2+L*D/2;
		if (len<L/2) return ;
		j=acos((L/2)/len);
		ans-=j*len*len-L/2*sqrt(len*len-(L/2)*(L/2));
	}
	else
	{
		j=acos(D/S);
		ans=(Pi-j)*S*S+D*sqrt(S*S-D*D);
	}
}
int main()
{
	freopen("hungry.in","r",stdin);
	freopen("hungry.out","w",stdout);
	int T;
	scanf("%d",&T);
	for (;T;--T)
	{
		solve();
		printf("%0.2lf\n",ans);
	}
	return 0;
}