标签:
1 #include<stdio.h> 2 #include<string.h> 3 int main () 4 { 5 int T, n, m, i, j, k; 6 char s[100][100]; 7 scanf("%d", &T); 8 while (T--) 9 { 10 scanf("%d %d", &n, &m); 11 for (i = 0; i < n; i++) 12 scanf("%s", s[i]); 13 scanf("%d", &k); 14 if (k == 0) 15 { 16 for (i = 0; i < n; i++) 17 { 18 for (j = 0; j < m; j++) 19 { 20 if (j != m-1) 21 printf("%c", s[i][j]); 22 else 23 printf("%c\n", s[i][j]); 24 } 25 } 26 } //旋转角为0时 27 else if (k == 90) 28 { 29 for (i = 0; i < m; i++) 30 { 31 for (j = n-1; j >= 0; j--) 32 { 33 if (j != 0) 34 printf("%c", s[j][i]); 35 else 36 printf("%c\n", s[j][i]); 37 } 38 } 39 } //旋转角为90时 40 else if (k == 180) 41 { 42 for (i = n-1; i >= 0; i--) 43 { 44 for (j = m-1; j >= 0; j--) 45 { 46 if (j != 0) 47 printf("%c", s[i][j]); 48 else 49 printf("%c\n", s[i][j]); 50 } 51 } 52 } //旋转角为180时 53 else if (k == 270) 54 { 55 for (j = m-1; j >= 0; j--) 56 { 57 for (i = 0; i < n; i++) 58 { 59 if (i != n-1) 60 printf("%c", s[i][j]); 61 else 62 printf("%c\n", s[i][j]); 63 } 64 } 65 } //旋转角为270时 66 } 67 return 0; 68 }
标签:
原文地址:http://www.cnblogs.com/syhandll/p/4441117.html