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: * * * **** *..* *..* **** ***** *****
hide comments
liuxueyang:
2016-07-16 14:09:35
@saumya_mehta just add newline if it's not the last case.
|
|
ss701:
2016-05-14 16:00:36
I wondered too, where my code went wrong.
|
|
matthewbal:
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.
|
|
cshubh:
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?????? |
|
justin0979:
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 |
|
saumya_mehta:
2016-02-15 13:29:27
how to add line breaks like that?? |
|
priye:
2016-01-24 19:06:01
why error always occurring in this q
|
|
Abhishek Kumar Singh:
2016-01-23 06:50:27
check for case 1 1, Helped in my case :) |
|
rtcoder:
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. |
|
Paul Charbonneau:
2016-01-12 11:18:44
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. |
Added by: | kuszi |
Date: | 2012-09-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |