0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

「AtCoder Beginner Contest 237B - Matrix Transposition」メモ

Posted at

問題

AtCoder Beginner Contest 237

考察

ansというh*wの二次元配列を0で初期化して用意する。次に$ans_{ji}$に$a_{ij}$を代入する。このとき、$ans_{ij}$と$a_{ji}$だとうまくいかないので注意する。

ACコード

h,w=map(int,input().split())
a = [list(map(int, input().split())) for _ in range(h)]

ans = [[0]*h for i in range(w)]

for i in range(h):
    for j in range(w):
        ans[j][i] = a[i][j]


for b in ans:
    print(*b)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?