记录编号 26082 评测结果 AAAAAAAAAA
题目名称 饥饿的母牛 最终得分 100
用户昵称 Gravatarreamb 是否通过 通过
代码语言 Pascal 运行时间 0.005 s
提交时间 2011-07-22 21:48:41 内存使用 0.25 MiB
显示代码纯文本
program jiedemuniu;
uses math;
const
  pi=3.1415926535898;
var
  d,s:int64;
  i,t:longint;
  l:real;
  ans,v,x,ss,p,q,x1,x2,x3:real;
function shanxing(r,x:real):real;
begin
  exit(pi*sqr(r)*x/(2*pi))
end;
begin
  assign (input,'hungry.in');
  reset (input);
  assign (output,'hungry.out');
  rewrite (output);
    readln (t);
    for i:=1 to t do
    begin
      readln (l,d,s);
      if s<=d then
      begin
        ans:=pi*sqr(s);
        writeln (ans:0:2)
      end
      else
        if sqr(s)<=sqr(d)+sqr(l/2) then
        begin
          l:=2*sqrt(sqr(s)-sqr(d));
          x:=arcsin(l/2/s)*2;
          ans:=shanxing(s,2*pi-x)+l*d/2;
          writeln (ans:0:2)
        end
        else
          if s<=sqrt(sqr(d)+sqr(l/2))+l/2 then
          begin
            ss:=sqrt(sqr(d)+sqr(l/2));
            x1:=arcsin(l/2/ss)*2;
            x2:=pi-(pi/2-x1/2);
            ans:=l*d/2+shanxing(s,2*pi-x1)+2*shanxing(s-ss,x2);
            writeln (ans:0:2)
          end
          else
          begin
            ss:=sqrt(sqr(d)+sqr(l/2));
            x1:=arcsin(l/2/ss)*2;
            x2:=pi-(pi/2-x1/2);
            p:=sqrt(sqr(s-ss)-sqr(l/2));
            q:=(s-ss-l/2)*p;
            x3:=arcsin(p/(s-ss));
            v:=shanxing(s-ss,x3)-(s-ss)*p/2;
            ans:=l*d/2+shanxing(s,2*pi-x1)+2*shanxing(s-ss,x2)-q-2*v;
            writeln (ans:0:2)
          end
    end;
  close (input);
  close (output)
end.