|
Time Limit:1sec Memory Limit:256mbdescriptionmirko has assembled a excellent crossword puzzle and now he WA NTS to frame it. Mirko ' s crossword puzzle consists of M x N Letters, and the frame around it should be U characters wide on top, L characte RS on the left, R characters on the right and D characters on the bottom side. The frame consists of characters # (hash) and. (dot) which alternate like fields on a chessboard. These characters should be arranged in a-a-would, if the frame is expanded to cover the entire crossword puzzle and we TR Eat these characters as a chessboard, the # characters should is placed as the red fields on a chessboard (i.e. the top le FT field). See the examples below for a better understanding of the task. Inputthe first line of input contains, integers M and N (1≤m, n≤10). The second line of input contains integers U, L, R, D (0≤u, L, R, D≤5). The following M lines of input contains N characters–lowercase letters of the English AlphAbet. These lines represent Mirko ' s crossword puzzle. Outputoutput the framed crossword puzzle as stated in the text. Sample Input copy sample Input to ClipboardExample 1:4 2 2 2honiokernerairak sample 2:2 0 3 1rimamama Sample OutputSample 1:#.#.#.#: #.#.#.##.honi#. #oker. ##.nera#. #irak. ##.#.#.#. #.#.#. #样例2: #.#.#. #rima. #.mama#.#.#.#.#.
problem#: 11157//submission#: 3719849//The source code is licensed under Creative Commons attribution-noncommercial-s Harealike 3.0 Unported license//uri:http://creativecommons.org/licenses/by-nc-sa/3.0///all Copyright reserved by Informatic Lab of Sun Yat-sen university#include <algorithm> #include <iostream> #include <string># Include <cstdio> #include <queue> #include <cstring> #include <vector> #include <iomanip> #include <map> #include <stack> #include <list>using namespace Std;int main () {int n, m; CIN >> n >> m; int U, L, R, D; CIN >> u >> l >> R >> D; vector<vector<char> > B (n + U + d); for (int i = 0; i < b.size (), i++) {vector<char> line (M + L + R); B[i] = line; } for (int i = 0; i < b.size (), i++) {for (int j = 0; J < b[i].size (); + j) {if ((i + j)% 2) B[I][J] = '. '; else B[i][j]= '#'; }} for (int i = 0; i < n; i++) {string S; Cin >> S; for (int j = 0; J < S.size (); j + +) {B[u + i][l + j] = S[j]; }} for (int i = 0; i < b.size (), i++) {for (int j = 0; J < b[i].size (); + j) {cout <&L T B[I][J]; } cout << Endl; } return 0;}
|