#P11271. 「Diligent-OI R1 A」DlgtPattern

「Diligent-OI R1 A」DlgtPattern

Problem Description

A cup is placed in an opaque box. The base of the cup can be regarded as a circle. The box can be regarded as a rectangular cuboid, and its thickness can be ignored.

Now place the bottom face of the box in a 2D Cartesian coordinate system. Its four vertices are at (0,0)(0,0), (x,0)(x,0), (0,y)(0,y), and (x,y)(x,y).

You only know that the center of the circular base of the cup is at (p,q)(p,q). What is the maximum possible radius of the cup’s base?

Input Format

Only one line is given, containing four integers x,y,p,qx,y,p,q.

Output Format

Output only one number: the maximum possible radius of the cup’s base.

10 5 3 4
1

Hint

Explanation for Sample #1

The situation where the cup radius is the largest is shown in the figure below.

Constraints

For 100%100\% of the testdata, 0<p<x1000<p<x\le100 and 0<q<y1000<q<y\le100.

Test Point ID Special Property
141\sim 4 AB
565\sim 6 B
7107\sim 10 None

Special Property A: x=yx=y.

Special Property B: x=2p,y=2qx=2p,y=2q. That is, the center of the cup’s base is at the geometric center of the box’s bottom face.

Translated by ChatGPT 5