June challenge chef and ingredients

I checked out solutions of chef and ingredients question but still could not understand. Can anyone please help me with the approach.

You just need to try
solving it on paper…
for first subtask you will notice that
when you give an input n=4 (answer is 6)
n=5 (answer is 10)
if you properly write it on paper it will be
for n=4, the numbers skipped will be 3,2,1…
for n=5, the numbers skipped will be 4,3,2,1…
so this is a series and it’s formula is n*(n-1)/2

when you do it for second subtask.
Try seeing the pattern…
(Hint, it’s an AP)

1 Like

I tried the “OEIS” approach, it gave me what seems to be good results (was comparing my oracle bruteforce solution with the formula I took from the oeis sequences), but still couldn’t pass the second subset of tests.

Others solutions seems to use an entirely different formula… Was the oeis solution a wrong way to do, but “magically” working for N <= 8?
For examples, theses sequences: A130518 - OEIS, A130520 - OEIS (with an offset related to N).

Edit: Dat -92 rating drop :frowning:

1 Like