CCC '03 J1 - Trident

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2003 Stage 1, Junior #1

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 an interactive 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

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

Comments


  • 0
    DingleReaper  commented on Dec. 21, 2022, 6:02 p.m.

    Hi, I'm having a bit of trouble with the logic of this question, I can't seem to think of how to start a base for my code as well, can someone help me please? Thank you so much! I'm having a lot of problems with implementation questions so it would help me a lot!


    • 1
      seal308  commented on Dec. 22, 2022, 4:11 p.m.

      Think of how many lines of asterisks you should print for the first input, how many asterisks you should print for the second input, and how many lines of asterisks you should print for the third.


  • 6
    Jeffrey_li_06105  commented on Sept. 1, 2022, 2:42 p.m.

    It looks like a fork though


    • 0
      anrdew_ng  commented on Dec. 12, 2022, 8:49 a.m.

      no it doesn't!


  • 4
    WayneSeng  commented on Oct. 25, 2020, 7:49 p.m.

    I had a lot of trouble on this question, but I think I finally figured it out. If you are having trouble with the last test case like I did, then make sure you check the values of t and s before printing a new line.


  • 7
    CountT  commented on Sept. 2, 2020, 3:48 p.m.

    Yeah the most common problem is that the judge counts extra space appended at the end. To fix this problem what I did was that I would only append spaces to the end and if it was the last to add spaces I wouldn't add it. i + 1 != 3;


  • 1
    cyopotatoe  commented on July 3, 2020, 4:55 p.m.

    Wait I'm confused what's wrong with mine? Pls halp, I'm stoopid


    • 6
      maxcruickshanks  commented on July 3, 2020, 5:11 p.m. edit 5

      For test case #1 and #2, you have a presentation error when submitting, meaning you're outputting excess spaces after the final tine asterisk (e.g., * * * \n, which should be * * *\n); this could be remedied by printing a new line after all of your asterisks on a line are printed.


      For the other three test cases, you are getting WAs (wrong answers): you are printing S tines with S spaces between them, instead of 3 tines with S spaces between them (this should be fixed first).


      • 4
        cyopotatoe  commented on July 3, 2020, 5:44 p.m.

        Thanks, I'm fixing it! :)


  • 6
    ArtyKing12  commented on July 29, 2018, 6:50 p.m.

    Its not that bad, just organize your code :) Did it in a couple min