title: Unable to Decrypt Python Algorithm
body: <p>I just started learning python and though the best way would be to solve few easy algorithm questions. I came across the question: </p>
  
  <p>A strange grid has been recovered from an old book. It has 5 columns and infinite number of rows. The bottom row is considered as the first row. First few rows of the grid are like this:</p>
  
  <pre><code>    ..............
  
      ..............
  
      20 22 24 26 28
  
      11 13 15 17 19
  
      10 12 14 16 18
  
      1  3  5  7  9
  
      0  2  4  6  8
  </code></pre>
  
  <p>The grid grows upwards forever!
  Rows are indexed from bottom to top and columns are indexed from left to right.
  The task is to find the integer in <strong>cth</strong> column in <strong>rth</strong> row of the grid.</p>
  
  <p>Example:
  Input: 6 3</p>
  
  <p>Output: 25</p>
  
  <p>The number in the 6th row and 3rd column is 25.</p>
  
  <p>The solution for this problem was:</p>
  
  <pre><code>import sys
  
  for line in sys.stdin:
  r = int(line.split(' ')[0])
  c = int(line.split(' ')[1])
  
  if r%2 == 1:
      print ((r-1)/2)*10 + (c-1)*2
  else:
      print ((r-1)/2)*10 + (c-1)*2 + 1 
  </code></pre>
  
  <p>I dint understand why are we taking <code>r%2 == 1</code> and why are we using <code>((c-1)*2)+1)+(((r-1)/2)</code></p>