A question regarding the question.....

Posted by

Jaideva 10 Nov 2013 01:06

The value of N is <= 50, so we are talking about a 100 digit number atmost.....how then the upper limit of S is 1000.....shouldn't it be 900.....or are we supposed to return 0 when (2*N*9) < S.

Am I missing something ?????

*Edited by author 10.11.2013 01:07*

Nevermind.....I solved it.....

Few useful insights :-

(i) if S > (2*9*N) output 0;

(ii) if S = 0 output 1; (otherwise you would get WA for test 5).

*Edited by author 10.11.2013 02:27*