2003 Canadian Computing Competition, Stage 1

Problem J1: Trident

A trident is a fork with three tines (prongs). A simple picture of a trident can be made from asterisks and spaces:

*  *  *
*  *  *
*  *  *
*******
   *
   *
   *
   *

In this example, each tine is a vertical column of 3 asterisks. Each tine is separated by 2 spaces. The handle is a vertical column of 4 asterisks below the middle tine.

Tridents of various shapes can be drawn by varying three parameters: t, the height of the tines, s, the spacing between tines. and h, the length of the handle. For the example above we have t = 3, s = 2 and h = 4.

You are to write a program to print a trident. Your program should accept as input the parameters t, s, and h, and print the appropriate trident. You can assume that t, s, h are each at least 0 and not larger than 10.

Sample Input

4
3
2

Sample Output

*   *   *
*   *   *
*   *   *
*   *   *
*********
    *
    *

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 27, 2008

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

http://wcipeg.com/problem/ccc03j1(trident)

what is this supposed to be..?

I was wondering, how can I improve my code to be more time efficient?

You can't make your code much more efficient, though I would recommend that you use for loops.