Advertisement
Guest User

Matrix

a guest
Oct 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. i, j, count, k = 1, 0, 2, int(input())
  2.  
  3. if k == 1:
  4.     print(0, 0)
  5. else:
  6.     while count < k:
  7.         i -= 1
  8.         j += 1
  9.         count += 1
  10.         if i == 0 and count < k:
  11.             i, j = j + 1, i
  12.             count += 1
  13.     print(i, j)
  14.  
  15. i, j = map(int, input().split())
  16. k = 2
  17. while i != 1 or j != 0:
  18.     if j == 0:
  19.         i, j = 0, i - 1
  20.         k += 1
  21.     i += 1
  22.     j -= 1
  23.     k += 1
  24.  
  25. print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement