标签:wan pre can tput line represent acm read desc
http://acm.hdu.edu.cn/showproblem.php?pid=2135
#include <bits/stdc++.h>
using namespace std;
int N, M;
char mp[15][15];
int main() {
while(~scanf("%d%d", &N, &M)) {
int flag;
if(M > 0) flag = 1;
else flag = 0;
memset(mp, 0, sizeof(mp));
for(int i = 1; i <= N; i ++) {
getchar();
for(int j = 1; j <= N; j ++)
scanf("%c", &mp[i][j]);
}
if(abs(M) % 4 == 0) {
for(int i = 1; i <= N; i ++) {
for(int j = 1; j <= N; j ++)
printf("%c", mp[i][j]);
printf("\n");
}
} else {
if(abs(M) % 4 == 2) {
for(int i = N; i >= 1; i --) {
for(int j = N; j >= 1; j --)
printf("%c", mp[i][j]);
printf("\n");
}
} else if(M > 0 && M % 4 == 1 || M < 0 && abs(M) % 4 == 3) {
for(int j = 1; j <= N; j ++) {
for(int i = N; i >= 1; i --)
printf("%c", mp[i][j]);
printf("\n");
}
} else if(M > 0 && M % 4 == 3 || M < 0 && abs(M) % 4 == 1) {
for(int j = N; j >= 1; j --) {
for(int i = 1; i <= N; i ++)
printf("%c", mp[i][j]);
printf("\n");
}
}
}
}
return 0;
}
标签:wan pre can tput line represent acm read desc
原文地址:https://www.cnblogs.com/zlrrrr/p/9709672.html