題目連結: https://zerojudge.tw/ShowProblem?problemid=a015

# 解題思路

輸入的時候是先列再行 (列優先) 的話,就再輸出的時候調整成先行再列 (行優先) 就好啦

# 程式碼

#include<iostream>
using namespace std;
int main( )
{
    int row,column;
    while(cin>>row>>column)
    {
        int num[row][column];
        for(int i=0 ;i<row;i++)
        {
            for(int j =0; j<column;j++)
                cin>>num[i][j];
        }
        for(int j=0; j<column;j++)
        {
            for(int i=0; i<row;i++ )
                cout<<num[i][j]<<" ";
            cout<<endl;
        }
    }
}
更新於 閱讀次數

用實際行動犒賞爆肝的我😀

Zrn Ye LinePay

LinePay