20 lines
382 B
Python
20 lines
382 B
Python
def solution(x, y):
|
|
prisonerID = 0
|
|
|
|
#traverse down the x axis first
|
|
i = x
|
|
while i > 0:
|
|
prisonerID += i
|
|
i -= 1
|
|
|
|
#traverse up the y axis second
|
|
while y > 1:
|
|
prisonerID += x
|
|
x += 1
|
|
y -= 1
|
|
|
|
#return the string of the id
|
|
return str(prisonerID)
|
|
|
|
|
|
print "Case 1,1: " + solution(1,1) |