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
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. |
|
assbrain:
2017-08-10 17:11:51
At first, I thought I got an idea(which is a very complex one), and suddenly I applied that, do you know what happens? Poooooof... I simply tried for 6 - 7 hours but every time I was wrong. After some time I take a deep look into the patterns then I realise that I have to modify just a few steps. Now with in 10 mins I finished this program... Experience.! Take a deep look inside the program before proceeding.
|
|
ipb_g6160032:
2017-03-30 19:19:51
AC in one go..
|
|
neelesh_25:
2017-01-09 12:17:42
It was tricky, but when I understood the trick the program was very brief.
|
|
pulkit1012:
2016-10-11 16:09:25
guys, i did it by adding 4 loops each displaying one row of the pattern. Is that the solution or was i (kind of) cheating? lemme know |
|
gaurav_1791:
2016-09-23 19:11:48
@ sgtfdotfcrfn thanks !! |
|
tig3r4ce:
2016-09-21 23:41:56
Code output for example input matches exactly on Ideone.com, but gives "wrong answer" when submitted. Not sure what the issue is. |
|
codeup:
2016-09-14 18:48:31
can any one help me........ I am a beginner in spoj and i am not able to solve the problem. |
|
sgtfdotfcrfn:
2016-08-16 21:52:57
It is quite easy if you observe the positions of asterisk columns mod 3. The procedure for placing rows is the same thing. |
|
Kunal Singh:
2016-07-24 15:45:06
Tricky one.... but easy finally done... :) |
Added by: | kuszi |
Date: | 2012-09-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |