HackerRank: Sherlock and Planes
mod%n
Watson gives four 3-dimensional points to Sherlock and asks him if they all lie in the same plane. Your task here is to help Sherlock.
Any three points for a unique plane. We find the equation of plane using any three points and check if the fourth point satisfies the equation or not.
Equation of a plane is ax+by+cz+d=0, where (a,b,c) is directly proportional to the normal. To calculate normal, we take a cross product of (B-A) and (C-A) where A,B,C are three points. To find d, we put any point in the equation.
http://www.martinkysel.com/hackerrank-sherlock-and-watson-solution/mod%n
if
__name__
=
=
'__main__'
:
n,k,q
=
map
(
int
,
raw_input
().split())
arr
=
map
(
int
,
raw_input
().split())
for
_
in
xrange
(q):
x
=
int
(
raw_input
())
print
arr[(x
-
k)
%
n]