|
|||||||||||||||||||
|
SPOJ time: 2012-05-25 02:24:05 |
CaterpillarsProblem code: HS11CTPR
There are two kinds of caterpillars: vertical and horizontal ones. A vertical caterpillar looks like this: ### [ --- here the first segment starts
..# [ --- here the first segment ends
###
#
[ --- the rest depends on the caterpillar's height
#..
###
..#
While a horizontal caterpillar looks like this: #.##[ middle segments of ].###. #.#.[ a horizontal ].#.#. ###.[ caterpillar ]##.## Print a caterpillar according to a given specification. Input data specificationInput consists of one letter V for vertical caterpillars or H for horizontal ones and an integer 2 < n < 20 - the caterpillar size in segments. Output data specificationCaterpillar as in the example below. Example 1Input: V3 Output: ### ..# ### #.. ### ..# Example 2Input: H6 Output: #.###.###.## #.#.#.#.#.#. ###.###.###. ScoringBy solving this problem you score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||