PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000388. Nhảy trượt tuyết (Ski Jumping)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Nhảy trượt tuyết (Ski Jumping)

Ski Jumping

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

A ski-jumping arena is modeled in a coordinate plane. The horizontal origin is at the hilltop and positive coordinates point in the flight direction. The hill is HH metres high and LL metres wide, with height h(x)h(x) given by:

$$h(x)=\begin{cases}H,&x<0,\\ H(1-2(x/L)^2),&0\le x<L/2,\\2H(x/L-1)^2,&L/2\le x<L,\\0,&x\ge L.\end{cases}$$

The skier descends through a vertical drop of jj metres on the approach and leaves horizontally at (0,H+p)(0,H+p), pp metres above the hilltop. Ignore friction and wind. Use gravitational acceleration g=9.81 m/s2g=9.81\,\mathrm{m/s^2}. Conservation of energy gives the launch speed v0=2gjv_0=\sqrt{2gj}. During flight the height is

f(x)=H+p−g2(xv0)2.f(x)=H+p-\frac g2\left(\frac{x}{v_0}\right)^2.

The skier lands at the first intersection of the flight curve with the hill, including the flat ground beyond it. Determine the landing coordinate, the magnitude of the velocity, and the nonnegative smaller angle between the velocity vector and the forward tangent to the hill at the landing point, measured in degrees.

Flight curve and hill

Input

One line contains four integers j,p,H,Lj,p,H,L, all measured in metres.

Output

Print three real numbers on one line: landing coordinate (m), landing speed (m/s), and landing angle (degrees). Each value is accepted with absolute or relative error at most 10−410^{-4}.

Subtasks

  • Subtask 1 (20 points): 1≤j,p,H,L≤5001\le j,p,H,L\le500. 4j(H+p)≥L24j(H+p)\ge L^2.
  • Subtask 2 (30 points): 1≤j,p,H,L≤5001\le j,p,H,L\le500. 16jp+8jH≥L216jp+8jH\ge L^2.
  • Subtask 3 (50 points): 1≤j,p,H,L≤5001\le j,p,H,L\le500.

Examples

Input

50 5 10 100

Output

40.82482905 33.83045965 12.93315449

Explanation

In the first half, solve 15−x2/200=10−x2/50015-x^2/200=10-x^2/500, giving x≈40.82482905<50x\approx40.82482905<50. Horizontal speed is 981\sqrt{981} and vertical velocity is −9.81x/981-9.81x/\sqrt{981}. Their magnitude is 33.83045965; hill slope is −40x/10000-40x/10000. The angle difference is 12.93315449 degrees.

Input

50 5 30 100

Output

81.04978134 40.31656580 26.21334827

Explanation

The second-half equation is 35−x2/200=60(x/100−1)235-x^2/200=60(x/100-1)^2, whose valid root is 81.04978134. Velocity components are 981\sqrt{981} and −9.81x/981-9.81x/\sqrt{981}, with magnitude 40.31656580. The hill slope 120(x−100)/10000120(x-100)/10000 yields angle 26.21334827 degrees.

Input

50 5 50 100

Output

104.8808848 45.38832449 46.36470132

Explanation

The flight meets the flat ground at x=11000>100x=\sqrt{11000}>100. Speed is 981+(9.81x/981)2≈45.38832449\sqrt{981+(9.81x/\sqrt{981})^2}\approx45.38832449. The ground is horizontal, so the angle is arctan⁡(x/100)\arctan(x/100) in degrees, 46.36470132.