Last active
August 29, 2015 14:16
-
-
Save AmaxJ/80b4603c69d1660e3b18 to your computer and use it in GitHub Desktop.
zen_grid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
line = raw_input() | |
temp = [int(x) for x in line.split()] | |
row, column = temp | |
def rowValue(row): | |
if row > 2 and row % 2 == 1: | |
return ((row - 1)/2) * 10 | |
elif row > 2 and row % 2 == 0: | |
return (((row/2) -1)*10) +1 | |
elif row == 1: | |
return 0 | |
elif row == 2: | |
return 1 | |
def final_value(row, column): | |
num = rowValue(row) | |
add = [0,2,4,6,8] | |
return num + add[column - 1] | |
answer = final_value(row, column) | |
sys.stdout.write(str(answer)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment