文章

94

粉丝

0

获赞

495

访问

15.7k

头像
矩阵翻转 题解:c++ ,输入的时候倒着输入外层矩阵就好,再遍历输出
P1134 西安交通大学机试题
发布于2026年1月20日 15:24
阅读数 181

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int num[n][n];
    for(int i = n-1;i >= 0;i--){
        for(int j = 0;j < n;j++){
            cin >> num[i][j];
        }
    }
    
    for(int i = 0;i < n;i++){
        for(int j = 0;j < n;j++){
            cout << num[i][j] << " ";
        }
        cout << endl;
    }
    
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发