[Community Puzzle] Fax machine

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Wontonimo,validated by @BugKiller_328,@Bon_Crayon and @LazyMammal.
If you have any issues, feel free to ping them.

More explanation of the example fax:

10 10 4

produces 10 black, then 10 white, then 4 black.
Because the picture is 8x3, the first 10 black cannot all fit in the first line. Only 8 fit, and so that is why we see 8 “"(black) in the top row, then 2 "”(black) in the second row.

|**      |
|    ****|

Same with the 10 white. Only 6 " "(white) can fit on the second row, so we see the remaining 4 " "(white) on the next row. Finally out of the “10 10 4” is the 4 black. We see that the last 4 characters in the last line are 4 “*”(black)

Hello Wontonimo,

This puzzle is very nice to learn.
I could solve it in java and translate in c++ !

Merci beaucoup !

1 Like

Enjoyable to do, thank you!

my solution is in a function for future use and mobility of the code and it prints the currect solution as a single line string and outputs as a muti line one and your puzzle does not accept it

[Mod edit: Please avoid posting code in the forum]

I think when you run your code, the console shows that an “End of line (\n)” is found at the end of your output. That’s because in the last step you split your string, and you’ll end up with an empty string as the final part of that split, and when you print that out, you have an extra line break. You should remove that.