Tuesday, July 08, 2008
My math is not that rusty yet =)
My math and problem analytic skill are not that rusty yet. This is proven by what happened today. So, in short, Chatrin sent an email about a math problem.
This is the algorithm that I derived. I eliminate the basic steps so you can find it out yourselves.
My math is not that rusty yet, hahaha....
Egg $0.10If you are not interested in knowing how it is solved, it doesn't matter. The answer is
Chicken $6
Watermelon $3
Question:
How many of above items to get the total 100 items of $100 dollar?
OR If from software point of view, how to calculate it by algorithm?
70 eggs, 10 chicken, and 1 watermelon
This is the algorithm that I derived. I eliminate the basic steps so you can find it out yourselves.
For w=0 till w=31w = watermelons, e = eggs, c = chicken.
.... c=(900-29w)/59
.... if c is a positive integer then
.... .... e = 100 - c - w
.... ....if e is a positive integer, then
.... .... .... return value of e, c, w (solved)
.... .... .... endif
.... endif
end for
return false (cannot be solved)
My math is not that rusty yet, hahaha....
Labels: game theory, mathematics
Subscribe to Posts [Atom]