Or you use fractions.
Maybe thatâs not a very related thing, but I had this as the weekly puzzle, I finished it, but it still didnât count it for me.
Same, does it need time to process or should it report this? Sorry new here and eager for my first Achievement
@MaxMindz @314Mat related to this:
https://www.codingame.com/forum/t/quest-map-new-home-page-feedbacks-bugs/185603/66
Hi
I wouldnât consider this puzzle to an easy one neither, It given me headache ^^
I didnât success to reach 100%, I had 83%, the last Validator didnât pass. Could I know whatâs his composition and the result wanted, so I could try correct my code.
Thanks
Since youâre not the first one asking for that validator Iâll put it there.
1
ratS 66
[ ( ratS [ ratS ( ratS ratS ) ] [ ratS ( ratS ratS ) ] ) ( ratS [ ratS ( ratS ratS ) ] [ ratS ( ratS ratS ) ] ) ]
Is it the fourth validator ?
My code didnât pass the fourth and I donât understand why
I posted the last one but apparently the 4th one poses problem too, here you go.
Btw is there a spoiler tag on this forum ?
5
Hotel 7
India 56
Juliet 24
Kilo 5
Lima 7
( Hotel [ India ( [ Juliet ( Kilo Lima ) ] ) ] )
Yeah. It consists in not posting what you donât want to spoil. Or using DMs, perhaps ?
Iâve sent PMs several times for other puzzles, it gets old really fast.
Thank you for your answer Djoums.
There was a case I didnât take into account with the way my code reduce the given pattern : ( [ A ] ) or [ ( A ) ]
Thanks,
My mistake was to want to keep only one character by resistance, so to success it Iâve changed it to String
for the record @Djoums @anon72424297 Iâm fine with you sharing validators publicly to unlock blocked players
I know that you are. Iâm not. But thatâs not to me to decide whatâs allowed.
Although the sample test cases pass, my code is failing the Test Case 3 (Combined). I am guessing after going through this forum that it is related to fractional calculations maybe. But then why is the Parallel only test case passing?
Summary
I am using the reduce
method to add up even the fractional parts of the parallel connection. And I round the result at the end when all resistors are done. Unrelated - am using regex to handle the innermost group of resistors first.
Is there something wrong in this approach? Does JS start to round off decimals ?
Hi,
Just to make sure I got you right: did your code pass all tests except the âCombinedâ one, or did you try only âSeriesâ, âParallelâ and âCombinedâ and failed on âCombinedâ without going any further ?
Anyway, itâs not so easy to answer your question without seeing your code (of course, you canât post it here, but you can send it in PM), especially to see how exactly you are using reduce()
.
JS is well known to be poor at handling small numbers with decimals, but I didnât run into any problem of this kind when solving this puzzle.
Just provide a way to parsing the expression here. Think of the expression ( A B ) or [ A B ] as one token. For token I mean the expression can be calculated directly.
With that in mind, now,
1. use stack to keep track of expression (push whatever you see into stack).
2. Whenever sees close parentheses ) or ], keep pop the stack until you see matching
open parentheses (all given expressions are valid so the first open parentheses should
be matching parentheses), Then you have one token.
3. Calculate it, push result back to stack, then continue reading the expression.
4. Repeat the process until read the full expression.
5. At the end, there should be only one item in stack which will be your result.
Itâs a fun little puzzle indeed. And there is no need for recursion as the author said
Nice Puzzle, I had troubles with having only one value after the dot. But I figured it out
Hi there,
Apparently there is an issue with âComplexâ, âMore Complexâ and â5-pointed Starâ tests suites, as we only have A resistors and empty circuit line.
Cpp version of the puzzle.
Any idea @anon79121980 or @stephan2342 please?
Cheers