#P3412. Ray
Ray
Description
There is a structure consisting of K homogenous slices of equal thickness. The refraction index of the i-th slice is Ni. A ray of light travels in the first slice at the angle a to the normal. Write a program to compute the angle that the ray will have to the normal in the last slice.
It is known that the formula N1sinα=N2sinβ holds in a two-sliced structure with the refraction indices of the slices equal to N1 and N2, respectively, when a ray of light passes from the first slice to the second, traveling at the angle a to the normal in the first slice, and at the angle b to the normal in the second slice.
Input
On the first line of the file is the number of slices K (1≤K≤100). Each of the following K lines contains the refraction index Ni of the corresponding slice. All the refraction indices are real numbers in the range from 0.000001 to 2000. The last line of the file contains the angle α between the ray and the normal in the first slice. The angle is a real number in the range from 0 to π/2 and is given in radians.
Output
The first and only line of the file must contain the angle β between the ray and the normal in the last slice. The answer must be given with the precision of 0.001. If the ray does not reach the last slice, the output must be the word ‘NO’.
2
1
2
0.02
0.01
Source
Northeastern Europe 2002, Western Subregion