Quote:
|
Originally Posted by thakarsagar
yes...suresh, my name is sagar...
Am tired of remainder problems...here is a different one...
i have infinite no of 1 Re, 5 Re, 10 Re and 25 Re notes...in how many ways can i give the change for Rs 100???
-sagar
|
joined pagal guy yesterday..and it gives me great satsfaction to contribute in this thread
acc. to me the ans is 242
the method is lil prehistoric ...but nonetheless the prob can be solved under 2 mins
soln a + 5b + 10c + 25d = 100
5b + 10c + 25d <= 100
here we try to get all the possible comb. so that the addition is =< 100. the add. if below 100 will be automatically adjusted by diff vales of a
for d = 0; c= 0,1,2....10
for c =0 ; d= 0,1,...20 ( 21 values )
slly, for c=1; d= 0,1....18 ( 19 values )
so on till c =10; d=0 ( 1 values )
similarly for d=1,2,3,4
the key is that since 10 is a multiple of 5 ,hence the total poss val are in ap , u need not count & addall the values. u can simply take the avg and multiply with the count
otherwise its tough to solve these kind of sums under time constrain