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.

@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.

according to the pattern i m getting two cases:

for n=2 and rest of the cases.

Is my approach right ?

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

@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 ?

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.

>

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.

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.

@Dum Yeah , I directly applied %M to final sum . It gave me all AC except the subtask 1.Whats your approach?

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

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

you said you are getting wa in 1st sub task right

so better put this if n == 2 then print n*(n+1)/2

so better put this if n == 2 then print n*(n+1)/2