#include #include using namespace std; void swap(int &a, int &b) { int t = a; a = b; b = t; } int main() { int angle, scale, height, width; cin >> angle >> scale >> height >> width; string pattern[10]; for (int i = 0; i < height; i++) { cin >> pattern[i]; } //rotating string rotatedPattern[10]; if (angle == 90 || angle == 270) { swap(height, width); } for (int i = 0; i < height; i++) { if (angle == 0) { rotatedPattern[i] = pattern[i]; continue; } rotatedPattern[i] = string(width, ' '); for (int j = 0; j < width; j++) { if (angle == 90) { rotatedPattern[i][j] = pattern[width - 1 - j][i]; } else if (angle == 180) { rotatedPattern[i][j] = pattern[height - 1 - i][width - 1 - j]; } else if (angle == 270) { rotatedPattern[i][j] = pattern[j][height - 1 - i]; } } } //scaling string scaledPattern[100]; height *= scale; width *= scale; for (int i = 0; i < height; i += scale) { for (int c = 0; c < scale; c++) { scaledPattern[i + c] = string(width, ' '); } for (int j = 0; j < width; j += scale) { for (int k = 0; k < scale; k++) { for (int l = 0; l < scale; l++) { scaledPattern[i + k][j + l] = rotatedPattern[i / scale][j / scale]; } } } } for (int i = 0; i < height; i++) { cout << scaledPattern[i] << "\n"; } int a; cin >> a; }