nfssdq's blog

By nfssdq, 10 years ago, In English

Problem Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=3884

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.

Full text and comments »

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