Submit | All submissions | Best solutions | Back to list |
HS11CTPR - Caterpillars |
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 specification
Input 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 specification
Caterpillar as in the example below.
Example 1
Input: V3 Output: ### ..# ### #.. ### ..#
Example 2
Input: H6 Output: #.###.###.## #.#.#.#.#.#. ###.###.###.
Scoring
By solving this problem you score 10 points.
Added by: | kuszi |
Date: | 2011-09-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 ASM64 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League |