Hello everyone. My name is Adam. For as long as I can remember, my sister and I have loved eating bananas. We do not share the same banana eating habbits however. I typically like eating the bananas earlier, when they are more green. My sister likes to eat the bananas later. You might think to yourself that we have ourselves a nice setup. I can buy a bunch of bananas and we can share, me eating the bananas earlier ones and her eating the later ones. But it turns out to be not so simple.
Suppose that the value I get from eating a banana can be given by ceil(.22*d^3-2.7*d^2+7.7*d+3.8) for integer values of d between 0 and 6 inclusive and d represents the number of days passed since purchasing the bananas. Also suppose that the value my sister gets from eating a banana is given by a graph that is symmetrical to mine about 3. As far as the cost of the bananas, the value of a dollar is worth 5 units of value to us.
On days that a banana is not eaten either of us, our little brother takes one for himself. This is to be avoided as he does not contribute money towards the bananas.
Maximize the combined value my sister and I can get from a bunch of bananas using the number of bananas bought and when they are eaten as variables. Bananas can only be bought at most one bunch per week and at most each person can eat one banana in a given day. The number of bananas consumed by my sister and I cannot differ by more than 1 for a given week. Bananas are sold in bunches of between 6-8 inclusive. Assume each banana weighs the same (.48 lb) and cost $1.42/lb.
Name:
Anonymous2013-01-21 0:48
>>38
You're indexing from 0, so on day 0 no one eats a banana meaning that the brother steals one.
Value of a banana: (* 5 (* 1.42 .48)) -> 3.408
Value of you eating a banana on the first day: 4.0
If you don't eat a banana on the first day your brother eats one, so effectively the value of eating a banana on the first day is 7.408, which is larger than six.
This idea became a bit convoluted because I completely forgot about the brother, but it seems I got lucky and it still works.
{0 1 2 3} and {2 3 4 5} or {0 1 2 3 4} and {3 4 5}
Name:
Anonymous2013-01-21 1:37
>>45 , so effectively the value of eating a banana on the first day is 7.40
This logic is flawed. The value of eating a banana on day one is still 4.
The idea behind the problem is to actually program a solution. Not look at the graph and guess what seems right.
> (list bananas (range 6 9))
'(((S S M M M M . null) . 34.552)
((S S MS M M M . null) . 40.144000000000005)
((S MS MS M M M . null) . 42.736000000000004))
And after all that, i looked back at the problem and saw that last line
>The number of bananas consumed by my sister and I cannot differ by more than 1 for a given week.
ugh, i bet that would make the math ugly (program not so much) banana
Name:
Anonymous2013-01-21 7:17
>>51
No, that shrinks the problem domain dramatically. Now you only have to check a linear number of bananas, rather than every partition of size 2 of the number of bananas.
Name:
Anonymous2013-01-21 22:09
>>52
Doesn't mean it won't make the code looks worse.
>>54 no u, see >>32,33,35,43
but really, trimming a few combinations off doesn't really seem too bad, just need to check -1<=x-y<=1 on each possible combo for validation...
Well well well [x3], Taskmaster burst, The bionic zit splitter, Breakneck speed, we drown ten pints of bitter, we lean all day, and some say that ain't productive, but that depends upon the demon that you're stuck with, 'cos right now
I see clearer than most, I sit here contented with this cheese on toast, I feel the pain of a third world famine, Segue, we count them blessings and keep jamming, 'tis him, scumbag, scum of the earth, his worth was nil, until he gained the skill of tongues, from 15 years young straight to my grey back self, I stay top shelf material, Jerk chicken, jerk fish, Break away slave bliss, Generate G's and then we stash them in the Swiss, Fools can't see this, Audio pistols, a fistful of hip hop donzai
Progressin' in the flesh, Esoteric quotes most frightening, Duppy took hold of my hand while I was writing, Let go me ting Duppy, Let go me hand, I summon up the power of banana clan...
...kind of lazy today, so just the first condition for the banana's thread...
selector = sum((b_mat > 1) .+ (b_mat == 4), 2) < 9;
Not bad, eh? eh? =D /reposted here for anti-thread-spaghettitation purposes.. ^^
Name:
Anonymous2013-01-27 1:54
Who is this faggot that keeps using this "^^" emoticon or whatever the fuck it is?
it's a draft version ^^ the power is not in the tidiness of the code.. it's in the flexibility xD it can handle whatever new rules are thrown at it, just by adding a few more 'conditions', rather than rewriting the generator each time..
Name:
Anonymous2013-01-28 4:18
>>76
Fuck off with your emoticons you insufferable little twat.
it can handle whatever new rules are thrown at it, just by adding a few more 'conditions' it's flexible in that you have to change the code when you want it to do something else my FUCKING FACE
Name:
Anonymous2013-01-28 6:00
ah you made me laugh ^^
what kind of magical codes do you use then?