CCC '02 J1 - 0123456789

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
Canadian Computing Competition: 2002 Stage 1, Junior #1
 _     _  _       _   _  _   _   _
| | |  _| _| |_| |_  |_   | |_| |_|
|_| | |_  _|   |  _| |_|  | |_|  _|

Most digital devices show numbers using a seven segment display. The seven segments are arranged as shown:

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

For this problem each segment is represented by three asterisks in a line as shown above.

Any digit from 0 - 9 can be shown by illuminating the appropriate segments. For example the digit 1 may be displayed using the two segments on the right side:

      *
      *
      *

      *
      *
      *

The digit 4 needs four segments to display it properly:

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

Write a program that will accept a single digit input from the user, and then display that digit using a seven segment display. You may assume that each segment is composed of three asterisks.

DMOJ-specific note: None of your lines should contain any trailing whitespace. The last line must end with a newline.

Sample Input

9

Sample Output

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

Comments


  • 0
    XTTH  commented on Dec. 8, 2018, 9:22 a.m.

    my code seems to work fine but when I submit it says "Presentation error"


  • 0
    Uzair_a  commented on Nov. 30, 2018, 6:55 p.m.

    My code works fine in eclipse but not when I submit it


  • 0
    TimothyW553  commented on Feb. 13, 2018, 4:04 p.m.

    New cases? What happened?


    • 2
      injust  commented on Feb. 13, 2018, 5:24 p.m.

      DMOJ-specific note: None of your lines should contain any trailing whitespace. The last line must end with a newline.


  • -2
    danielzyy  commented on Dec. 16, 2017, 1:44 p.m.

    You should also state that if the horizontal section in the middle is not used, there should be no space separating the vertical bars. Therefore the number 1 would display as one continuous line, and 0 would not have a break in it as well.


    • 3
      d  commented on Dec. 17, 2017, 3:39 a.m.

      Actually, the official answer requires the empty middle section, and your code is judged against 3 cases (none of the cases are 1 or 7).


    • 1
      wleung_bvg  commented on Dec. 16, 2017, 10:52 p.m.

      I don't believe it will make a difference. The judge appears to accept both options.


  • -4
    Jerry_Gu  commented on Dec. 2, 2017, 10:20 a.m.

    why does my code work fine in netbeans but it doesn't work when I submit it?


    • 0
      Kirito  commented on Dec. 2, 2017, 10:42 a.m.

      Your call to in.nextLine() is likely throwing the NoSuchElementException.


  • 0
    jkguipqnjcy49979693  commented on Oct. 14, 2017, 4:25 p.m. edit 2

    RE: Kotlin judges

    See this

    -> the submissions judged as "CE" when resubmitted do compile eventually (my guess is that the judge "Lemuria" is the source of the problem cause it says "1.0.3" as the Kotlin version and the others say "1.1.50")

    (EDIT: fixed link)


    • -2
      Xyene  commented on Oct. 14, 2017, 6:30 p.m.

      You're right: the language selection page lists kotlinc 1.0.3 - 1.1.50, java 1.7.0 - 1.8.0 as the currently supported runtime ranges (these are queried automatically from each judge). I don't know enough about Kotlin to determine the cause of that compilation error, but all judges should have 1.1.50 now.


      • 0
        jkguipqnjcy49979693  commented on Oct. 14, 2017, 6:59 p.m.

        Yup, seems to be fixed. Thanks!

        (I am guessing the issue was probably related to multiline strings)