in reply to Re: Faster (but uglier) PWC 350-2 solutions
in thread Faster (but uglier) PWC 350-2 solutions

In the first loop you check for $i being A and in the second for $i being B hence $i / $witness .

That's a different interpretation° of the task B = A * k , the OP was only doing the A part.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

°) According to Choroba that's the fun part of PWC ;-)

Replies are listed 'Best First'.
Re^3: Faster (but uglier) PWC 350-2 solutions
by ysth (Canon) on Dec 10, 2025 at 00:46 UTC
    None of the examples involve finding A given B, but that just means they work either way. But to me the problem statement is clear: "the number of integers $i in the range $from <= $i <= $to that belong to at least $count different shuffle pairs".
      See, different interpretations!

      All examples list the smallest A first. And B = A * k is explicit about k being an integer. For the other way k would need to be a fraction.

      Let's agree that only God knows. (and probably Choroba ;-)

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      see Wikisyntax for the Monastery