#include<bits/stdc++.h>
using namespace std;
int t;
int n,m;
vector<vector<int> > v;
int flag=0;
void rot(int x,int y,vector<vector <int> > a,int angle)
{
if(flag==1)
return ;
if(angle==0)
{
flag=1;
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)
cout<<a[i][j]<<" ";
cout<<endl;
}
return ;
}
vector<vector<int> > tmp;
tmp.resize(max(x,y),vector<int>(max(x,y)));
for(int i=0;i<x;i++)
for(int j=0;j<y;j++)
{
tmp[j][x-i-1]=a[i][j];
}
rot(y,x,tmp,angle-90);
//return ;
}
int main()
{
cin>>t;
while(t--)
{
cin>>n>>m;
v.resize(max(n,m),vector<int>(max(n,m)));
for(int i=0;i<n;i++)
for(int j=0;j<m;j++)
cin>>v[i][j];
int angle;
cin>>angle;
rot(n,m,v,angle);
flag=0;
}
return 0;
}
旋转数组<vector>
最新推荐文章于 2024-06-15 11:44:36 发布