201503-1 图像旋转

实现

#include <cstdio>

#define MAXN 0x3ef

int origin_matrix[MAXN][MAXN];
int new_matrix[MAXN][MAXN];

int main() {
    int x_size, y_size;
    scanf("%d%d",&x_size,&y_size);

    for (int i = 0;i < x_size;++i) {
        for (int j = 0;j < y_size;++j) {
            scanf("%d",&origin_matrix[i][j]);
        }
    }
    for (int i = 0;i < x_size;++i) {
        for (int j = 0;j < y_size;++j) {
            new_matrix[y_size - 1 - j][i] = origin_matrix[i][j];
        }
    }

    for (int i = 0;i < y_size;++i) {
        for (int j = 0;j < x_size;++j) {
            printf("%d ",new_matrix[i][j]);
        }
        printf("\n");
    }
}
posted @ 2020-08-28 10:58  amonqsq  阅读(98)  评论(0编辑  收藏  举报