OpenJudge

999:Repeater

总时间限制:
1000ms
内存限制:
65536kB
描述

Harmony is indispensible in our daily life and no one can live without it----may be Facer is the only exception. One day it is rumored that repeat painting will create harmony and then hundreds of people started their endless drawing. Their paintings were based on a small template and a simple method of duplicating. Though Facer can easily imagine the style of the whole picture, but he cannot find the essential harmony. Now you need to help Facer by showing the picture on computer.

(参考译文:和谐在我们的日常生活中是不可或缺的,谁也离不开它----但也许Facer是唯一的例外。 有一天,会传言重复绘画将创造和谐,然后数百人开始了无尽的绘画。 他们的绘画是基于一个小模板和一种简单的复制方法。 尽管Facer可以很容易地想象整个画面的风格,但他却无法找到本质的和谐。 现在,您需要通过在计算机上显示图片来帮助Facer。)
You will be given a template containing only one kind of character and spaces, and the template shows how the endless picture is created----use the characters as basic elements and put them in the right position to form a bigger template, and then repeat and repeat doing that. Here is an example.

(参考译文:您将获得一个只包含一种字符和空格的模板,模板显示如何创建无尽的图片----使用字符作为基本元素,并将其放在正确的位置以形成更大的模板,然后重复做下去。 下面是一个例子。

# #
  #      <-template(模板)
# #
So the Level 1 picture will be(所以Level 1的图片如下)

# #
  #
# #
Level 2 picture will be(Level 2如下)

# #     # #
  #         #
# #     # #
     # #  
      #    
     # #  
# #    # #
  #        #
# #    # #

输入
The input contains multiple test cases.
The first line of each case is an integer N, representing the size of the template is N*N (N could only be 3, 4 or 5).
Next N lines describe the template.
The following line contains an integer Q, which is the Scale Level of the picture.
Input is ended with a case of N=0.
It is guaranteed that the size of one picture will not exceed 3000*3000.
(输入包含多个测试用例。
每个案例的第一行是整数N,表示模板的大小是N * N(N只能是3,4或5)。
接下来的N行描述模板。
以下行包含整数Q,它是图片的缩放级别。
N = 0的情况下输入结束。
保证一张照片的尺寸不超过3000 * 3000。)
输出
For each test case, just print the Level Q picture by using the given template.
(对于每个测试用例,只需使用给定的模板打印Level Q画面。)
样例输入
3
# #
 # 
# #
1
3
# #
 # 
# #
3
4
 OO 
O  O
O  O
 OO 
2
0
样例输出
# #
 # 
# #
# #   # #         # #   # #
 #     #           #     # 
# #   # #         # #   # #
   # #               # #   
    #                 #    
   # #               # #   
# #   # #         # #   # #
 #     #           #     # 
# #   # #         # #   # #
         # #   # #         
          #     #          
         # #   # #         
            # #            
             #             
            # #            
         # #   # #         
          #     #          
         # #   # #         
# #   # #         # #   # #
 #     #           #     # 
# #   # #         # #   # #
   # #               # #   
    #                 #    
   # #               # #   
# #   # #         # #   # #
 #     #           #     # 
# #   # #         # #   # #
     OO  OO     
    O  OO  O    
    O  OO  O    
     OO  OO     
 OO          OO 
O  O        O  O
O  O        O  O
 OO          OO 
 OO          OO 
O  O        O  O
O  O        O  O
 OO          OO 
     OO  OO     
    O  OO  O    
    O  OO  O    
     OO  OO     
来源
2011年北京大学计算机研究生机试真题及九度
全局题号
15141
添加于
2017-05-24
提交次数
2
尝试人数
2
通过人数
2

Other language verions