有一个游泳池,形状为等腰直角三角形,直角边长250米。
游泳池可以看作是在坐标系统中(如上图所示)。用一条两端点在三角形边上的线段把游泳池分成两个面积相同的部分。
游泳池可以看作是在坐标系统中(如上图所示)。用一条两端点在三角形边上的线段把游泳池分成两个面积相同的部分。
在给定线段其中一个端点的情况下,要你编程输出另一个端点。
题解:
先判断端点在哪一条边上,每一条边有:>中点,<中点,=中点三种情况,然后进行一些数学算法~~~~。
代码:
var
x,y:longint;
t:real;
begin
readln(x,y);
if (x>0)and(y>0) then
if x=125 then writeln('0.00 0.00')
else
if x>y then
writeln('0.00 ',250-(15625/x*2):0:2)
else
if x<y then
writeln(250-(15625/y*2):0:2,' 0.00');
if x=0 then
begin
if y=125 then writeln('0.00 250.00')
else
if y<125 then
begin
t:=15625/(250-y)*2;
writeln(t:0:2,' ',250-t:0:2);
end
else
if y>125 then
begin
t:=15625/y*2;
writeln(t:0:2,' 0.00');
end;
end
else
if y=0 then
if x=125 then writeln('0.00 250.00')
else
if x<125 then
begin
t:=15625/(250-x)*2;
writeln(250-t:0:2,' ',t:0:2);
end
else
if x>125 then
begin
t:=15625/x*2;
writeln('0.00 ',t:0:2);
end;
end.