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.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值