Help

Pages: 123
what should be the answer of n=1 and k=6 ?
PLz explain also..
UPDATE: I got AC, was making a silly mistake.

@lame , read the question properly, n>=2 is a constraint, if n was 1, the answer would be infinite.

also please refer to @blackmamba 's reply, he has given a good explanation which is way more than enough to solve the problem. its simple. just look for the PATTERN.
N>=2 as stated in problem
according to the pattern i m getting two cases:

for n=2 and rest of the cases.

Is my approach right ?
first try for n=2, you'll see an obvious pattern, then try for n=3, and so on.. pattern will be much clearer then
is there any corner case...I m getting second subtask wrong.
okay
Last edited on
closed account (STD8C542)
ok
Last edited on
@theKlaw Please provide me that test case bro
Last edited on
@iotaa and @blackmamba and @theKlaw

Can u explain this problem for n=3 and k=2 ?

According to me there are infinite number of unreachable points.

For above case: starting with 2,4,6,8,10............ in this case we are getting only even numbers.
>
Can u explain this problem for n=3 and k=2 ?

initially chef has infinite amount of k to k+n-1 (inclusive).
so for k=2, n=3, chef initially has 2,3,4.
only 1 is unreachable by those values.
@anup30 did you get AC in sub task 1 ? Can you give me a hint

Last edited on
@TheTimes i got AC in sub task 1
did you get AC in subtask 2?
Last edited on
@Dum Yeah , I directly applied %M to final sum . It gave me all AC except the subtask 1.Whats your approach?
@TheTimes Can you give me some testcase
@Dum k = 7 and n = 3
2
large cases bro not small
Last edited on
It's small bro , 7 8 9 14 15 16 17 18 21 22 23 24 25 26 27 28 29 30 ...etc
as you can see Missing numbers are :
1 to 6 - 6
10 to 13 - 4
19 to 20 -2
So you can see a AP series with 6 , 4, 2
with common difference -2 i.e nothing but n -1
yeah i did the same but 2nd case in 2nd subtask is failing
you said you are getting wa in 1st sub task right
so better put this if n == 2 then print n*(n+1)/2
Pages: 123