Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110126 | 胡海峰老师 | 数组转置 | C++ | Accepted | 1 MS | 276 KB | 534 | 2025-02-14 23:08:41 |
#include <iostream> using namespace std; int main(){ int a[4][4],tmp; for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) cin>> a[i][j]; for(int i=1;i<=3;i++) for(int j=1;j<=3;j++) { if(i>j) { tmp = a[i][j]; a[i][j] = a[j][i]; a[j][i] = tmp; } } for(int i=1;i<=3;i++) { for(int j=1;j<=3;j++) cout<< a[i][j]<<" "; cout<< endl; } return 0; } /* Input 1 2 3 4 5 6 7 8 9 Output 1 4 7 2 5 8 3 6 9 */