Area (叉积)

Description

Your task is to write a program, which, given two circles, calculates the area of their intersection with the accuracy of three digits after decimal point.

Input

In the single line of input file there are space-separated real numbers x1 y1 r1 x2 y2 r2. They represent center coordinates and radii of two circles.

Output

The output file must contain single real number - the area.

Sample Input

20.0 30.0 15.0 40.0 30.0 30.0

Sample Output

608.366



const
     dx:array [0..9] of longint=(0,1,1,1,0,0,0,-1,-1,-1);
     dy:array [0..9] of longint=(0,-1,0,1,-1,0,1,-1,0,1);

var
     x,y,a,b,ans:int64;
     s:ansistring;
     t,i:longint;

begin
  readln(t);
  while t>=1 do
  begin
   readln(s);
   if length(s)<3 then writeln('0')
     else begin
           ans:=0;
           x:=0; y:=0;
           for i:=1 to length(s) do
            begin
             a:=x+dx[ord(s[i])-48];
             b:=y+dy[ord(s[i])-48];
             ans:=ans+(a*y-x*b);
             x:=a; y:=b;
            end;
    if ans<0 then ans:=-ans;
    if ans mod 2=0 then writeln(ans div 2)
                   else writeln(ans div 2,'.5');
           end;
     dec(t);
   end;
end.


猜你喜欢

转载自blog.csdn.net/g2523054231/article/details/79049850