checker in Ticket Puzzle

Back to General discussions forum

mooninvader     2020-07-22 20:52:36

for the case

11
092434=101
578529=134
475289=261
971840=287
663946=279
366080=205
168382=271
763991=102
364195=191
238615=292
302889=128

i have the answer :

0 (5)*(7)*((8)-5)+29 (4)*((7)*(5)+28)+9 0 6*((6)*(3)*(9)/(4)+6) 0 1+((6)*(8)-3)*((8)-2) (7)*((6)-3)+(9)*(9)*1 (3)*((64)+1)-(9)+5 (2)*(3)*(8)*6-((1)-5) (3)*(0)-2*((8)-(8)*9)

checker refused my answer 2

(5)*(7)*((8)-5)+29 = 134

where is the error please???

qwerty     2020-07-22 21:33:16

Your idea of using brackets to enclose numbers unstead of operations is interesting, but looks like it not works.

I suppose the following expression would be correct: (((5*7)*(8-5))+29)

mooninvader     2020-07-22 22:37:28

my answer was : (5)(7)((8)-5)+29 = 134 (all * above are missing , i don't know why) and it's has been refused...

mooninvader     2020-07-22 22:42:13

(5)X(7)X((8)-5)+29 has been refused

qwerty     2020-07-23 04:56:43

Good morning, mooninvader.

Asterics are missing in your posts, because each pair of them marks text to be emphasized with italics.

See Help page on Markdown at Code Abbey for more details.

About your expression - let imagine that I am a checker and is trying to interpret your expression:

  1. Innermost bracketed expression is (8). I calculate it and get 8.
  2. Three pairs of brackets on the same level. (5) equals to 5, (7) yields to 7 and finally (8-5) equals to 3.
  3. Calculating 5*7, result is 35.
  4. Now I calculate 3+29 (there are no brackets left, so I have no idea about right order), 3+29 equals to 32.
  5. And finally I multiply 35 to 32 and result of the whole expression is 1120. But result should be 134, so... I refuse to accept your answer.
Rodion (admin)     2020-07-23 06:15:14
User avatar

Hi Friends!

I'm sorry, but qwerty_one seems to be correct - reviewing problem statement I see (in the restriction section):

please surround every binary operation by brackets to avoid priority issues

(by coincidence markdown in problem statement also was a bit broken and this requirement was not emphasized - I fixed this)

Sorry for this inconvenience.

As about parentheses around every single value - I looked into checker code and seems these also could be problem, but you can easily get rid of them in your code. Hm-m-m... or I can improve checker to replace such things with regexp if you insist... :)

mooninvader     2020-07-23 19:05:37

thank you all, I will find a better approach, besides all those extra parenthesis all ugly. if the solution is not simple enough that's mean this is not the better one.

mooninvader     2020-07-24 19:59:24

thak you all guys, i solved it the solution is not that mush elegant : I used the buit in python function eval and was forced to deal with leading zeros since eval don't accept it : but the function itself is only ten lines length

Rodion (admin)     2020-07-25 06:35:31
User avatar

the solution is not that mush elegant

honestly, I don't know solution for this problem. Here are few problems of such kind - people suggested them and I knew how to create data generator and answer checker - and created them - but never had clear idea of how to solve :)

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