1 def main(): 2 3 r,c = map(int, raw_input().split(' ')) 4 5 if r % 2 != 0: 6 base = 5*(r-1) 7 else: 8 base = 5*(r-2) + 1 9 10 col = (c-1) * 2 11 12 print base + col 13 14 main()
Link:
https://www.hackerrank.com/challenges/strange-grid/submissions/code/11668215
学习:
本质就是找各个纬度的逻辑关系