CCC '01 J1 - Dressing Up

View as PDF

Submit solution

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

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

It is important to keep our computers safe and clean. Some people feel that computers should be well-dressed, also. For this question, you will write a program to print out a bow tie on the computer screen.

Your program should take as input the height H of the bow tie, where H is an odd positive integer greater than or equal to 5. A bow tie with H rows (and 2H columns) should then be printed using the pattern shown below in the sample output.

Input Specification

One line containing integer H. You may assume that all input data will be valid.

Sample Input 1

5

Sample Output 1

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

Sample Input 2

7

Sample Output 2

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

Comments


  • 8
    HisMonDon  commented on Feb. 5, 2024, 11:01 p.m. edited

    for those who are stuck on this question: split the tie into 3 parts:upper part, middle, and lower part for the middle part, it's just the whole line in the middle an easy way to solve the upper and lower part is to create 2 variables! also remember the while true function


    • 5
      HisMonDon  commented on Feb. 15, 2024, 2:19 a.m.

      wow i thought id get way more downvotes than just 1


      • -18
        htoshiro  commented on Feb. 15, 2024, 3:05 p.m.

        This comment is hidden due to too much negative feedback. Show it anyway.


  • -2
    960t  commented on Aug. 29, 2022, 8:20 p.m.

    what if the input is an even number


    • 9
      PythonMaster  commented on Aug. 30, 2022, 3:18 p.m. edited

      It says that H has to be an odd positive number on the third line so you will never get an even number.


      • 10
        960t  commented on Jan. 6, 2023, 6:07 a.m.

        sorry


  • 65
    cyopotatoe  commented on July 3, 2020, 9:06 p.m.

    My handsome little computer is getting fancy


    • 1
      Xavier  commented on Dec. 2, 2021, 9:14 p.m.

      lol


  • 63
    milan3sa  commented on June 3, 2020, 12:24 a.m.

    Wow I just made the world's most useless program


  • 9
    Medi  commented on Oct. 13, 2016, 12:01 a.m.

    When I test my code off of the website, it displays the proper output, yet when it's published to the website, I get WA three times in a row. Does my output have to be printed all at once, or can each line be printed separately? I'm not sure if that is the problem.


    • 27
      Xyene  commented on Oct. 13, 2016, 12:32 a.m.

      You're printing an extra blank line both before the bowtie and after.