import sys
import math
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
arr = test.split()
values = []
n = int(math.sqrt(len(arr)))
matrix = [0]*n
for i in range(n):
array = [0]*n
for j in range(n):
array[j] = arr[i*n + j]
matrix[i] = array
sol = [0]*n
for i in range(n):
array = [0]*n
for j in range(n):
array[j] = matrix[n-j-1][i]
sol[i] = array
ans = ""
for i in range(n):
for j in range(n):
if i > 0 or j > 0 :
ans += " "
ans += sol[i][j]
print ans
test_cases.close()
import math
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
arr = test.split()
values = []
n = int(math.sqrt(len(arr)))
matrix = [0]*n
for i in range(n):
array = [0]*n
for j in range(n):
array[j] = arr[i*n + j]
matrix[i] = array
sol = [0]*n
for i in range(n):
array = [0]*n
for j in range(n):
array[j] = matrix[n-j-1][i]
sol[i] = array
ans = ""
for i in range(n):
for j in range(n):
if i > 0 or j > 0 :
ans += " "
ans += sol[i][j]
print ans
test_cases.close()
No comments:
Post a Comment