## CCC '02 J1 - 0123456789

View as PDF

Points: 3
Time limit: 0.5s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### 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

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

• commented on June 10, 2020, 11:19 p.m.

That was a lot of ctrl c and ctrl v :)

• commented on Oct. 31, 2019, 9:40 p.m. edited

Do I need to add spaces between the horizontal asterisks? I'm using Python 3 and it seems to be displaying fine but I got all WAs.

Edit: Ohhh you need to match the segment location I get it now.

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

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

• commented on Dec. 18, 2019, 1:02 p.m.

Make sure you add an empty line on the bottom, I completely forgot to do that...

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

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

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

New cases? What happened?

• 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.

• 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.

• 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).

• 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.

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

This comment is hidden due to too much negative feedback. Click here to view it.

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

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

• 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")

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.