20分救命啊

B2106 矩阵转置

```cpp #include<bits/stdc++.h> using namespace std; int a[102][102],b[102][102],m,n; double yes; int main(){ cin>>m>>n; for(int i=1;i<=m;i++){ for(int j=1;j<=n;j++){ cin>>a[i][j]; } } for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cout<<a[j][i]<<" "; } cout<<endl; } return 0; } ``` 13 14行 n m写反了
by luuia @ 2024-04-15 19:44:10


@[hopefire](/user/1339024) lz后面n m是反的 所以先读入m @[duaneryan](/user/1162744)
by luuia @ 2024-04-15 19:45:15


@[duaneryan](/user/1162744) 第一次双重循环到<=n,<=m,第二次才是<=m,<=n
by hopefire @ 2024-04-15 19:46:09


@[luuia](/user/557800) e才看见,刚才以为是读入的问题
by hopefire @ 2024-04-15 19:47:32


那就是13、14行的问题了
by hopefire @ 2024-04-15 19:48:55


@[hopefire](/user/1339024) @[luuia](/user/557800) 谢谢大佬,所以转置到底是什么意思啊?
by duaneryan @ 2024-04-15 19:51:10


@[duaneryan](/user/1162744) 原来坐标数对翻转(a,b)变(b,a)
by hopefire @ 2024-04-15 19:55:15


@[hopefire](/user/1339024) 懂了懂了,谢谢大佬
by duaneryan @ 2024-04-15 20:33:57


|