Advertisement
maxim_shlyahtin

extra

Dec 25th, 2022
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. import numpy as np
  2.  
  3. #1
  4. def solve(shape: tuple, dtype):
  5. return np.ones(shape, dtype=dtype)
  6.  
  7. #2
  8. def solve(array):
  9. matrix = np.array(array)
  10. return matrix.ravel()
  11.  
  12. #3
  13. N = int(input())
  14. dtype = input()
  15.  
  16.  
  17. def solve(N, dtype):
  18. return np.identity(N, dtype=dtype)
  19.  
  20.  
  21. print(solve(N, dtype))
  22.  
  23. #4
  24. N = int(input())
  25. if N % 2 == 1 and 3 <= N <= 15:
  26. matrix = np.eye(N, dtype=int)
  27. res = np.flip(matrix, 0) + matrix
  28. for i in range(N):
  29. for j in range(N):
  30. if res[i][j] != 0:
  31. res[i][j] //= res[i][j]
  32. for i in res:
  33. print(*i, end='\n')
  34. else:
  35. print(-1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement