#30123: 要重複讀取!!!


ningenwoyamaru (よう女の桜)

學校 : 國立臺中第二高級中學
編號 : 191983
來源 : [223.141.245.252]
最後登入時間 :
2024-04-24 15:20:56
a015. 矩陣的翻轉 | From: [36.235.173.175] | 發表日期 : 2022-04-30 12:28

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c[100][100],d[100][100];
    while(cin>>a>>b){ //小陷阱
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                cin>>c[i][j];
            }
        }
        for(int i=0;i<a+b;i++){
            for(int j=0;j<a+b;j++){
                d[j][i]=c[i][j];
            }
        }
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                cout<<d[i][j]<<" ";
            }
            cout<<endl;
        }
    }
}

 
ZeroJudge Forum