jeudi 22 février 2018

How can we write a recursive function using java for how many ways can a batsman score a century(100) in all 6's and 4's?

For example he can score If you want exactly 100 (and not 102 or 104104, etc) Then there are the possibilities 10⋅6+10⋅4=100, 12⋅6+7⋅4=100, 14⋅6+4⋅4=100, 16⋅6+1⋅4=100, 8⋅6+13⋅4=100, 6⋅6+16⋅4=100, 4⋅6+19⋅4=100, 2⋅6+22⋅4=100 And if you allow that no 6's required and he can make 100 with only 4's then this is the 9th possibility, 0⋅6+25⋅4=100.

Aucun commentaire:

Enregistrer un commentaire