nfssdq's blog

By nfssdq, 6 years ago, In English,

Problem Link:

The problem states that, a billiard table of size S*S and a billiard ball at point (x1,y1) is given. There is another point given at (x2,y2) and when we shoot the ball it goes through the second point. So what is minimum number of times the ball will hit horizontal or vertical sides before returning to the initial point? For more details/constraints please visit the problem link.

What is the idea/approach to solve this problem? Help appreciated.

  • Vote: I like it
  • +4
  • Vote: I do not like it

6 years ago, # |
  Vote: I like it +5 Vote: I do not like it

I think the best thing to do is reading the editorial of SRM 626, hard problem of div1. It starts with the main trick of this problem.