CPTTRN2 - Character Patterns (Act 2)

Using two characters: . (dot) and * (asterisk) print a frame-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 of a frame.

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:
*
*
*

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

*****
*****

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

hide comments
2016-07-16 14:09:35 liuxueyang
@saumya_mehta just add newline if it's not the last case.
@tambot your output is here: http://paste.lisp.org/display/320593

submit the problem in common lisp. anyone is a common lisp user? ;-)
2016-05-14 16:00:36
I wondered too, where my code went wrong.
This is the test case that helped me to correct my code:
Input:
1
3 2
Hope it helps someone :-)
2016-04-30 14:44:06
This question seems incredibly finicky. Ive tested all edge cases I can think of, low numbers high numbers, odds evens, doubles, etc. Every time I get a good looking "frame" but the example cases don't show how we should handle the outliers. I assume if there isnt enough space then no dots will be printed (eg any combination with 1 or 2 rows/lines). any combination with 0 lines can't be printed.

The line breaks throws me off but all the comments here seem to say its not that issue... I just don't understand its such a simple pattern but how am I meant to randomly guess how they want it.
2016-03-09 15:00:27
My code is ruuning correctly on ideone,com but at spoj it is giving runtime error in c++....please help??????
2016-03-05 09:03:51
I've tried implementing if 0 were input, my patterns of 1, 2, 3,4 (with all combo's of each) and up to 40 have produced good patterns, even when repeated in excess of 10 times each. Not sure. Any other tips besides the low number one ( which helped me with 0, but still not getting right answer; but, thank you for that tip)? Since 0 is an input, I've left in the newline but still failed. Took out the newline, still failed. EDIT: I was wrong, in my first sentence (leaving all that other comment just to follow my train of thought).

Last edit: 2016-03-06 18:45:27
2016-02-15 13:29:27
how to add line breaks like that??
2016-01-24 19:06:01
why error always occurring in this q
2016-01-23 06:50:27 Abhishek Kumar Singh
check for case 1 1, Helped in my case :)
2016-01-18 08:58:21
Why is it giving me wrong? With the same input as the example, I print identical output, with just an extra linebreak at the bottom.
2016-01-12 11:18:44 Paul Charbonneau
For everyone stuck at this problem: double line breaks are not the problem. You have to think of all the possible strange test cases and their output. For a little hint: the strange inputs are not very big numbers.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.