We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Mathematics
- Geometry
- Jim Beam
- Discussions
Jim Beam
Jim Beam
Sort by
recency
|
9 Discussions
|
Please Login in order to post a comment
I've got a question: Suppose Jim is at (0,0), the mirror is at (0,2) and the wall goes from (0,1) to (1,1); now, can Jim cast the beam or not? It depends: If the wall is an open line segment (doesn't include the endpoints) the answer is YES, while if it's close, the answer is NO.
Do we know which case we're dealing with?
I suggest using vectors. Solve vector form of solution for pi + siqi
where pi are the position vectors and qi the translation ones
for the scalars s.
For intercept, system must be solvable and both scalars are >= 0 and <= 1.
otherwise there is none.
include
using namespace std;
int main() { int t; cin>>t; double x1,y1,x2,y2,xm,ym,x0,y0; for(int i=0;i
The solution method proposed by the editorial is non-obvious and possibly more complicated than it needs to be. A more intuitive and straightforward method (to this former vector calculus teacher) is to use parametric equations to describe the beampath and the wall. If Ri is the vector = , then problem can be rewritten " Does there exist an s and t (both between 0 and 1) so that s*R2 + (1-s)*R1 = t*Rm. From there it is straightforard linear algebra. The only special case that needs any particular care is the case where the lines are parallel, so the equations are indeterminate.
Can someone please check my code submission? I am getting wrong answer for all except the sample test case although I feel I am close to the answer.