mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
40 lines
579 B
C++
40 lines
579 B
C++
|
#include <iostream>
|
||
|
#include <algorithm>
|
||
|
using namespace std;
|
||
|
|
||
|
inline void test()
|
||
|
{
|
||
|
int n,m;
|
||
|
cin>>n>>m;
|
||
|
int** a=new int*[n];
|
||
|
for(int i=0;i<n;i++)
|
||
|
{
|
||
|
a[i]=new int[m];
|
||
|
for(int j=0;j<m;j++)
|
||
|
{
|
||
|
cin>>a[i][j];
|
||
|
}
|
||
|
}
|
||
|
for(int j=0;j<m;j++)
|
||
|
{
|
||
|
for(int i=0;i<n-1;i++)
|
||
|
{
|
||
|
cout<<a[i][j]<<" ";
|
||
|
}
|
||
|
cout<<a[n-1][j]<<endl;
|
||
|
}
|
||
|
for(int i=0;i<n;i++)
|
||
|
{
|
||
|
delete[] a[i];
|
||
|
}
|
||
|
delete[] a;
|
||
|
}
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
int n;
|
||
|
cin>>n;
|
||
|
while(n--) test();
|
||
|
return 0;
|
||
|
}
|