using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); int kakudo = inpt[0]; int zoom = inpt[1]; inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); int tate = inpt[0]; int yoko = inpt[1]; char[][] map = new char[tate][]; for (int i = 0; i < tate; i++) { map[i] = Reader.ReadLine().ToArray(); } for (int i = kakudo; i > 0; i-=90) { map = Rotate(map); } tate = map.Length; yoko = map[0].Length; char[][] newMap = new char[tate * zoom][]; for (int i = 0; i < tate; i++) { for (int j = 0; j < yoko; j++) { for (int k = 0; k < zoom; k++) { int row = i * zoom + k; if(newMap[row] == null) { newMap[row] = new char[yoko * zoom]; } for (int l = 0; l < zoom; l++) { int col = j * zoom + l; newMap[row][col] = map[i][j]; } } } } Console.WriteLine(Print(newMap)); } private string Print(char[][] src) { StringBuilder ans = new StringBuilder(); for (int i = 0; i < src.Length; i++) { for (int j = 0; j < src[i].Length; j++) { ans.Append(src[i][j]); } ans.AppendLine(string.Empty); } return ans.ToString().Trim(); } private char[][] Rotate(char[][] src) { int tate = src[0].Length; int yoko = src.Length; char[][] ret = new char[tate][]; for (int i = 0; i < tate; i++) { ret[i] = new char[yoko]; for (int j = 0; j < yoko; j++) { ret[i][j] = src[yoko -1- j][i]; } } return ret; } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 90 1 5 6 .#.... .#.... .##### .#.... .#.... "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }