您的答案為: 9 1 0 正確答案為: 9 1 0
您的答案為: 9 9 3 7 7 正確答案為: 9 9 3 7 7
#include <iostream> using namespace std; int main(){ int x,y,t; while(cin >> y >> x >> t){ int a[y][x],n,zero=0,one=1,tmp[y][x]; for(int i=0;i<y;++i) for(int j=0;j<x;++j) cin >> a[i][j]; while(t--){ cin >> n; (n)?one*=-1:++zero; } if(one==-1){ for(int i=0;i<y;++i) for(int j=0;j<x;++j) tmp[y-i-1][j]=a[i][j]; for(int i=0;i<y;++i) for(int j=0;j<x;++j) a[i][j]=tmp[i][j]; } zero%=4; if(zero==0){ cout << y << " " << x << "\n"; for(int i=0;i<y;++i){ for(int j=0;j<x;++j) cout << a[i][j] << " "; cout << "\n"; } } else if(zero==3){ cout << x << " " << y << "\n"; for(int j=0;j<x;++j){ for(int i=y-1;i>=0;--i) cout << a[i][j] << " "; cout << "\n"; } } else if(zero==2){ cout << y << " " << x << "\n"; for(int i=y-1;i>=0;--i){ for(int j=x-1;j>=0;--j) cout << a[i][j] << " "; cout << "\n"; } } else{ cout << x << " " << y << "\n"; for(int j=x-1;j>=0;--j){ for(int i=0;i<y;++i) cout << a[i][j] << " "; cout << "\n"; } } } }