You are not logged in. Please login at www.codechef.com to post your questions!

×

Pizza Slice (XYPIZQ) mini editorial

7
1

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:

$x,3x,5x,7x..$

while the angles of the sides go

$0.5\pi-0.5x$

$0.5\pi-1.5x$

$0.5\pi-2.5x$

$0.5\pi-3.5x$

$..$

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

asked 14 Jan, 18:00

bad_jim's gravatar image

5★bad_jim
1515
accept rate: 25%

edited 14 Jan, 18:21


Answer is hidden as author is suspended. Click here to view.

answered 14 Jan, 19:40

karangreat234's gravatar image

4★karangreat234
(suspended)
accept rate: 0%

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

link

answered 14 Jan, 20:31

thermocol's gravatar image

2★thermocol
1
accept rate: 0%

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

link

answered 14 Jan, 23:40

sudhanshuom199's gravatar image

3★sudhanshuom199
1
accept rate: 0%

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

(15 Jan, 00:37) bad_jim5★

Really great efforts! Keep up the good work.

link

answered 15 Jan, 06:18

include_sajal's gravatar image

4★include_sajal
1716
accept rate: 0%

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.

link

answered 16 Jan, 17:54

spookywooky's gravatar image

4★spookywooky
161
accept rate: 33%

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.

(18 Jan, 04:24) bad_jim5★

Really an awesome editorial

link

answered 30 Jan, 20:39

sudarshanb's gravatar image

4★sudarshanb
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×15,678
×159
×109
×17

question asked: 14 Jan, 18:00

question was seen: 2,085 times

last updated: 30 Jan, 20:39