A problem where the minimum number of a specific type of operations is to be done.

35 Views Asked by At

enter image description here

Hello everybody! I saw this problem by a user sparkle23 which I found too interesting not to share.

The answers given by the user sparkle23 are $8,7,11$.

Unfortunately, I could not solve the problem. The user hopeless404 suggested this:

For any instruction $I$, the total amoebae increase by $I-1$. In the case of $(a)$, you can write a Diophantine eq which is $$23+(7-1)a+(12-1)b+(16-1)c=114$$ where the letters correspond to how many times their instruction is given.

but that would take too much time to test all the possible cases..

I have no idea how to start this but I thought of a brute-force thing but you can never be sure to have found the minimum value given that the values of $N$ and other things are pretty big in the sub-parts. Probably we can develop a recurrence relation and I think we'll have to do that but how? I probably think that the the solution given by hopeless404 should work..

Any help would be appreciated. Thanks.

1

There are 1 best solutions below

3
On BEST ANSWER

The calculation using the equation $$(A-1)a+(B-1)b+(C-1)c=N-K$$ is reasonably easy if you use modular arithmetic.

For example, question(b)

$$6a+14b+15c=67$$

Modulo $3$ (it's a good idea to use divisors of the coefficients) the equation becomes $2b\equiv 1$ (mod $3$) i.e. $b\equiv 2$ (mod $3$). The only possibility is $b=2$.

Then $6a+15c=39$ i.e. $2a+5c=13$ gives $a=4,c=1$.

Can you do the others now? Arguably the most involved is Question (c) where $$8a+11b+25c=138$$ For a solution with a small number of instructions, you can consider separately the cases

$c=0, b\equiv 6$ (mod $8$) i.e $b=6$

$c=1, b\equiv 3$ (mod $8$) i.e $b=3$

$c=2, b\equiv 0$ (mod $8$) i.e $b=0$ or $8$

etc.

Note that $c=2,b=8$ gives a solution with $N=10$.