跟b965一樣
#include<bits/stdc++.h>
using namespace std;
int a[10][10],b[10][10];
void mirror(int r,int m)
{
for(int i=0;i<r;i++)
{
for(int j=0;j<m;j++)
{
b[r-1-i][j]=a[i][j];
}
}
for(int i=0;i<r;i++)
{
for(int j=0;j<m;j++)
{
a[i][j]=b[i][j];
//cout<<b[i][j]<<" ";
}
}
}
void rotate (int r,int m)
{
for(int i=0;i<r;i++)
{
for(int j=0;j<m;j++)
{
b[(m-1)-j][i]=a[i][j];
//cout<<a[m-1-x][j]<<" ";
}
// cout<<endl;
}
for(int i=0;i<m;i++)
{
for(int j=0;j<r;j++)
{
a[i][j]=b[i][j];
// cout<<b[i][j]<<" ";
}
//cout<<endl;
}
}
int main()
{
int r,m,c,z,op[10];
while(cin>>r>>m>>c)
{
for(int i=0;i<r;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<c;i++) cin>>op[i];
for(int g=c-1;g>=0;g--)
{
if(op[g]==0)
{
rotate(r,m);
swap(r,m);
//cout<<endl<<r<<" "<<m<<endl;
}
else
{
mirror(r,m);
}
}
cout<<r<<" "<<m<<endl;
for(int i=0;i<r;i++)
{
cout<<a[i][0];
for(int j=1;j<m;j++) cout<<" "<<a[i][j];
cout<<endl;
}
}
}