Growing Bacteria
Growing Bacteria
I think I don't get the description of the algorithm correctly.
When I calculate the first 8 days starting with one bacteria, I find that there are 48 bacterias after 8 days, not 47.
I wrote the algorithm in C++, but of course my answer isn't correct, which is to expect when I can't even work out the first 8 days manually...
Could anyone hint me out ?
When I calculate the first 8 days starting with one bacteria, I find that there are 48 bacterias after 8 days, not 47.
I wrote the algorithm in C++, but of course my answer isn't correct, which is to expect when I can't even work out the first 8 days manually...
Could anyone hint me out ?
Each bacterium is able to generate ONLY two new bacteria, one in the next day to its birth and the second in the second day after is birth. Each one of the generated bacteria follow these rules too. It is also necessary to remove from population the dead bacteria (I think that jeetee has forgotten to kill the first bacterium to get 48 instead of 47 in the 8th day).
Cheers,
Bruno.
Cheers,
Bruno.
-
- Posts: 1
- Joined: Tue Mar 17, 2009 11:38 pm
-
- Posts: 7
- Joined: Thu Mar 05, 2009 2:22 pm
-
- Posts: 35
- Joined: Tue May 12, 2009 6:08 pm
- Location: Greece
Damn. I tried over weeks to create some java code for the bacteria cycle. I got the cycle of the new bacteria kind in code. Then I remembered the current topic of our maths lessons. Two minutes of calculator action. But hey, at least I learned a lot about coding java.
And to the guys wondering about the cycle. It says that there is that cycle for a bacteria and that scientist have found a new kind of that bacteria. But really, don't focus on the cycle so much.
And to the guys wondering about the cycle. It says that there is that cycle for a bacteria and that scientist have found a new kind of that bacteria. But really, don't focus on the cycle so much.
Found a rather simple solution via Access
Code excerpt as follows (don´t wonder about german words, i´m german ^^)
s is the amount of bacteria after day x
a, b, c, d, and e are the amount of bacteria which are in stadium 1, 2, 3, 4, 5 accordig to challange´s description
a1, b1, c1, d1 are auxiliary variables to save the old data for preventing circle-referrence between variables
Code excerpt as follows (don´t wonder about german words, i´m german ^^)
Code: Select all
x = 1
a = 1
b = 0
c = 0
d = 0
e = 0
...
s is the amount of bacteria after day x
a, b, c, d, and e are the amount of bacteria which are in stadium 1, 2, 3, 4, 5 accordig to challange´s description
a1, b1, c1, d1 are auxiliary variables to save the old data for preventing circle-referrence between variables