[Community Puzzle] 7-segment display

The rules have changed!! :expressionless:

Excellent. I really appreciate that you took the effort to fix the inconsistencies. Thank you!
The alternative (advanced) version could be available as a separate community puzzle as it can be used to demonstrate slightly vague and eventually surprising requirements that will test how adaptable one’s solution is.

I get that :

Console output
Standard Output Stream:

>  ##
> #  #
> #  #
>  ##
> #  #
> #  #
>  ##

Failure
Found: Nothing

Expected: Nothing

What I am missing?

1 Like

The console output only shows lines from the first non empty line to the last non empty line. You may have printed an empty line after the output. Check your code to see if this happens, and if it does, remove the extra newline.

1 Like

Thanks TheNinja, that what it!

I realized this too. I did not appreciate that the input for the puzzle says “An integer N for the number to print.”, but then has constraints that require a long.

Well, a long is an integer, isn’t it ? ^^

The stub uses int the data type for input, but has value that doesn’t fit into an int in one of the validators.
This cannot be rationalized in any way other than sloppy design

In fact, in lots of language, there is only one type of integer (64b signed) ; some even have one type for both integers and real numbers (double with 52 or 54b significant).

Even for C / C++, in some 64b OS, int is 64b (ILP64) ; btw, CG seems to use LP64 OS, so you have to use long for 64b :slight_smile:

Don’t care about the length, just read it as a string.

irrelevant. The stub has int and long as data types. Long should have been used.

See what you mean ; btw, I used a string as well here, much simpler to get the digits from left to right without pain.

The inertia of thinking is strong with this one… , lol.

    uint64_t Number;
    cin >> Number; cin.ignore();
    string sNumber = to_string(Number);

The “integer” in this case is a math definition, not a computer language definition.

screw the definition, we have evidence.
the default code generated for the puzzle can’t handle input for one of the validators, and that’s it.

1 Like

That’s actually what I ended up doing, I took the int we were given by default and ran it through to_string() so that I could just index to each digit in the number. However, using that int at all was what caused the problems. By the time I had converted to a string, the damage had already been done.

Which would be understandable if in the confusion, I had been the one to try to use the incorrect version of an int. However, since the base code was presented as:

int N;
cin >> N; cin.ignore();…

I should not still need to question which type of int was being referred to.

You just saved my day ! Thanks !

Wrote solution in python3 and all test cases pass in CUSTOM mode (the one where i can see input and output in split) but on clicking SUBMIT or on PLAY ALL buttons it fails. I wondering what the case it could be. Thanks in advance. For instance:

Failure
Found: Nothing
Expected: Nothing

Found the reason while editing my post, it’s the difference in evaluating trailing ‘\n’, removing it solved the problem.