Problem link
Solution: The solution turns out to be the Fibonacci sequence. This result is intuitive since for n, the possible situations will be.
Find the law, fib. The law can be found, f(k) = f(k-1)+f(k-2). There are two types of light: one layer of glass from the outer stage and two layers of glass from the outside. The light from the outside of the two layers of glass is the light that was reflected last time. The light from the outside of the glass is the light that was reflected last time, so it satisfies the
fib sequence.
All the rays in n−1 bounce off the bottom/top surface, plus
All the rays in n−2 bounce off the top/bottom surface and then bounce off the middle surface.
The result can be really big, so use Java BigInteger can be helpful.
reference
A solution in java
0 Comments
If you have any doubts, Please let me know