Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- #1
- def solve(shape: tuple, dtype):
- return np.ones(shape, dtype=dtype)
- #2
- def solve(array):
- matrix = np.array(array)
- return matrix.ravel()
- #3
- N = int(input())
- dtype = input()
- def solve(N, dtype):
- return np.identity(N, dtype=dtype)
- print(solve(N, dtype))
- #4
- N = int(input())
- if N % 2 == 1 and 3 <= N <= 15:
- matrix = np.eye(N, dtype=int)
- res = np.flip(matrix, 0) + matrix
- for i in range(N):
- for j in range(N):
- if res[i][j] != 0:
- res[i][j] //= res[i][j]
- for i in res:
- print(*i, end='\n')
- else:
- print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement