// No.565 回転拡大 // https://yukicoder.me/problems/no/565 // #include #include #include using namespace std; vector> rotate_pict(int R, vector> &pict); int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int R, K; cin >> R >> K; int H, W; cin >> H >> W; vector> pict(H); for (auto i = 0; i < H; ++i) pict[i].resize(W); for (int y = 0; y < H; ++y) for (int x = 0; x < W; ++x) cin >> pict[y][x]; vector> rpict = rotate_pict(R, pict); for (auto y = 0; y < rpict.size(); ++y) { for (auto ky = 0; ky < K; ++ky) { for (auto x = 0; x < rpict[0].size(); ++x) { for (auto kx = 0; kx < K; ++kx) { cout << rpict[y][x]; } } cout << endl; } } } vector> rotate_pict(int R, vector> &pict) { int h, w; if (R == 90 || R == 270) { w = pict.size(); h = pict[0].size(); } else { h = pict.size(); w = pict[0].size(); } vector> rpict(h); for (auto i = 0; i < h; ++i) rpict[i].resize(w); for (auto y = 0; y < h; ++y) { for (auto x = 0; x < w; ++x) { switch (R) { case 0: rpict[y][x] = pict[y][x]; break; case 180: rpict[y][x] = pict[h-y-1][w-x-1]; break; case 90: rpict[y][x] = pict[w-x-1][y]; break; case 270: rpict[y][x] = pict[x][h-y-1]; break; default: break; } } } return rpict; }