CPTTRN2 - Character Patterns (Act 2)

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


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 of a frame.


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.


3 1
4 4
2 5




hide comments
quockhanh2002: 2023-09-09 22:12:35

Everyone can see my answer : <snip>
[Simes]: no thanks

Last edit: 2023-09-10 09:57:57
langcao: 2021-10-09 17:33:51

@lastcomrade Thanks for your advice!

puneet19: 2021-06-29 17:45:07

not only print the pattern but also look for the spaces after each pattern successfully being printed.

lastcomrade: 2020-09-29 02:43:58

To those who are getting a WA on some hidden test case... My advice to you is to think of a test case when we have only 1 line and only 1 column and thus design your solution keeping that in mind. Also, a little tip try to use string or character arrays for the following lines and just print accordingly on the basis of the number of the line you are iterating on currently. Hope this helps. Cheers!

nithin1997: 2020-01-14 07:43:27

Got the output for the given test case but the hidden test case is failing, can anyone help me.

Last edit: 2020-01-14 10:59:15
nagaraj_hwp: 2019-12-30 08:31:54

Even counted the spaces and did the exact output for that, still Run time error

anhduc2641999: 2019-12-23 09:47:00

Last edit: 2019-12-23 09:49:05
vaibs101: 2019-05-28 17:28:28

My output matches with expected output but also then it is giving an error due to hidden outputs please help!

Last edit: 2019-05-28 17:29:38
kkartik: 2019-03-13 19:57:23

my solution gives the desired output yet it shows it's wrong answer,why?

manoj228: 2018-11-04 15:45:00

i got the answer, Prakash.
:) Our team works makes great.

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