2002 Canadian Computing Competition, Stage 1

Problem J1: 0123456789

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.

Sample Input

9

Sample Output

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

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Oct 01, 2008

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

Comments (Search)

My third test case is saying that it is wrong, please can anybody help me!
My problem is that in the test case it is show some weird clipped area. Can someone help me ?

The output shown will always be clipped.

why is it clipped though?

If you get a typo, showing the entire output would be too obvious. Clipping the output lets you to figure the problem with the code out yourself.

My code passes all the test cases but the last one. could someone help?

Whats the point of this question? Hardcoding skills?

i agree that there doesn't have much more than hardcoding

The point being that this is a CCC question. Like it or not, this is what you can expect on the CCC, so it's here for practice.

i mean, really. in javascript, this is really easy, just do:
if(n == 1){
System.out.println("*
*
*

*
*
*
}

That's not a cheat.
And that's not Javascript.
And don't post answers.

hey ken
you lousy punkass bitch

I don't remember swearing being allowed

the 1st test case doesn't work, what does it mean by clipped? How to fix?

Clipped means that the judge doesn't show all of your output. It will only show a few lines of output. Your output is just wrong(try checking if it exactly matches the output)

I believe that my code worked, but apparently not...

Look at the segments at the top of the problem statements and compare how those segments look to how your program prints them.


Spaces?

Yes, make sure spaces are present between the asteriks going horizontal.