Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. n = int(input())
  2. mas = [[0 for i in range(2 * n - 1)] for i in range(n)]
  3. start = (2 * n - 1) // 2
  4. lst = []
  5. for i in range(n):
  6.     lst = list(map(int, input().split()))
  7.     size = len(lst)
  8.     ind = 0
  9.     for j in range(start, start + size):
  10.         mas[i][j] = lst[ind]
  11.         ind += 1
  12.     start -= 1
  13. typ = input()
  14. count = 0
  15. count_need = 1
  16. need_str = 1
  17. if typ == "counterclockwise":
  18.     for j in range(2 * n - 1 - 1, -1, -1):
  19.         for i in range(n):
  20.             if count != count_need:
  21.                 if mas[i][j] != 0:
  22.                     print(mas[i][j], end = " ")
  23.                     count += 1
  24.             else:
  25.                 print()
  26.                 count = 0
  27.                 need_str += 1
  28.                 count_need= need_str * 2 - 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement