CPTTRN3 - Character Patterns (Act 3)


Using two characters: . (dot) and * (asterisk) print a grid-like pattern.

Input

You are given t - the number of test cases and for each of the test cases two positive integers: l - the number of lines and c - the number of columns in the grid. Each square of the grid is of the same size and filled with 4 dots (see the example below).

Output

For each of the test cases output the requested pattern (please have a look at the example). Use one line break in between successive patterns.

Example

Input:
3
3 1
4 4
2 5

Output:
****
*..*
*..*
****
*..*
*..*
****
*..*
*..*
****

*************
*..*..*..*..*
*..*..*..*..*
*************
*..*..*..*..*
*..*..*..*..*
*************
*..*..*..*..*
*..*..*..*..*
*************
*..*..*..*..*
*..*..*..*..*
*************

****************
*..*..*..*..*..*
*..*..*..*..*..*
****************
*..*..*..*..*..*
*..*..*..*..*..*
****************

hide comments
le_hue_369: 2020-03-27 02:50:06

My hint is to use strings that include "\n". AC for the first time.

anhduc2641999: 2019-12-23 10:30:20

Last edit: 2019-12-23 10:30:50
rohan811: 2019-08-15 05:32:52

simple problem... check the pattern carefully..!!
AC in one go...!!

vishesh_2308: 2019-06-12 09:04:52

Very easy question.

shiva_dragneel: 2018-08-22 11:21:57

How to reduce the memory space? I always have 28M in python but some users reduce it to 9.8M. How?

x_coder33: 2018-08-07 12:12:35

It's easy problem, I tried many times but at last i knew the trick, its a little math trick, take a deep lock into the pattern and you will guess it

aquib_ansari: 2018-06-23 15:40:54

Use this simple logic to calculate the total number of lines and columns :
l = (l + 1) + ( l * 2 )
c = (c + 1) + (c * 2)
now apply the logic to add stars and dots
stars will be applied at first line and the lines which give 0 on mod 3, same is the case with columns

lohithsai: 2017-12-27 13:26:03

O(1) solution for this problem reply me asap,thanks in advance

sai_sravanth09: 2017-10-03 11:23:30

I need help. I did the program and the output is correct each time I run the program. But my solution is not getting excepted.

rushikeshkoli: 2017-09-01 16:17:58

That was a great one! Solved it in nearly 10 mins. I am getting confidence now!!! I solved it using the trick of pattern 2 and little modification.


Added by:kuszi
Date:2012-09-03
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64