Brainfuck problem 117 Divide by two

Back to Problem Solutions forum

Menshikov Ivan     2019-03-01 11:29:00
User avatar

Hello!
Can't figure out, what's wrong with my solution.
Codeabbey is certain that for test with input '11' my answer is '11 0'.
I checked my program with several online compilers. Final dump is "000 011 001 001 005", which I found correct.
The end of my code is ">>>>:>++++++++++++++++++++++++++++++++.<<:"
I just have no idea, what's wrong with this part.
Thank you in advance

Rodion (admin)     2019-03-01 12:58:03
User avatar

Ivan, Hi!

curious to see the person from the same city I live in, ha-ha - probably, the first time :)

Codeabbey is certain that for test with input '11' my answer is '11 0'.

Either you've updated your code, or it was about different input. I've tried it now and it gives 5 1...

The problem seems to be (embarrassing for me) that you output additional space between values. However it looks that our implementation of BF already outputs space for : command - so you just need not all these plus signs at the end.

P.S. I've found it is not said in the BF++ description, about this space - so I've updated the manual, sorry and thanks!

Hopefully this helps!

Menshikov Ivan     2019-03-01 16:29:34
User avatar

Thank you, now it works!
And wow. That's the last place I'd expect to meet a neighbor :)

Rodion (admin)     2019-03-01 16:45:48
User avatar

Yep, I even have become a bit nervous first, thinking that you may be working in the same school where I give my electronics classes (embarrassing feeling when I can't recollect a colleague) - but if Interned tells the truth, it's 166 while I'm in 566 :)

Menshikov Ivan     2019-03-01 17:52:36
User avatar

It is 166 indeed. Close to 566, but not close enough if you know what i mean :)

Please login and solve 5 problems to be able to post at forum