Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24275 | 老方 | 矩阵转置 | C++ | Accepted | 0 MS | 252 KB | 388 | 2023-08-10 12:44:36 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; cin>>n>>m; int ns[n][m]; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>ns[i][j]; } } int ns2[m][n]; for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ ns2[i][j]=ns[j][i]; } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cout<<ns2[i][j]<<" "; } cout<<endl; } return 0; }