Pizza Slice (XYPIZQ) mini editorial

Consider this diagram. Half of the line segments are drawn in red. The line segments a_0b_1,b_1a_2,a_2b_3,b_3a_4 also exist, but are ommited here for clarity.

alt text

We do not yet know what angle x is, but we can work out the other angles in terms of x. We will be working in radians here. \pi\ radians = 180\ degrees

Because the slice is an isosceles triangle, we can calculate:

c = \frac{\pi-x}{2} = 0.5\pi - 0.5x

Knowing that all the inner triangles are also isosceles trangles, we can also calculate:

d = \pi - 2c = x

e = c - d = 0.5\pi - 1.5x

f = \pi - 2e = 3x

g = \pi - c - f = 0.5\pi -2.5x

h = \pi - 2g = 5x

i = \pi - e - h = 0.5\pi - 3.5x

j = \pi - 2i = 7x

Also because of the isosceles triangle, x = i, so we can now derive the value of x:

x = 0.5\pi - 3.5x

4.5x = 0.5\pi

9x = \pi

Now we can go back and substitute \frac{\pi}{9} for x and work out all the angles exactly.

We can also see a pattern in the angles. The angles of the tops of the triangles go:


while the angles of the sides go






So we can work out the angles of specific triangles with closed form formula, instead of having to calculate them all.


This is better than the original editorial :slight_smile:

I really appreciate this editorial, more clear thought process. I agree to karan that it’s better than original.

Since a0a1b2 is isosceles as side |a0a1| = |a1b2| so i = x, but you are saying i = 0.5π - 3.5x, so i think it is wrong

Why would i or x not be equal to 0.5π - 3.5x?

Really great efforts! Keep up the good work.



The sum ob the angels in a triangle are 180 degrees, and all angels in the pizza slice can be calculated using this knowledge.
But how do you translate that angel values to the right answer to the queries of the 4 types?
I didn’t got this, AxByAz thing.

AxByAz means a triangle with it’s vertices at Ax, By and Az. The one in the middle is where you want to calculate the angle.

Note the constraints, specifically abs(x-y) = 1 and abs(y-z) = 1. Or to put it another way, x = y \pm 1 and z = y \pm 1. There are just a few possibilities for every query type, and the simplest thing to do is to go through them all manually, eyeball the diagram and code the answer for each case.

Really an awesome editorial