Quite certainly not in every case, but for some challenges this seems to be what is happening.CodeX wrote:I think the page you get after solving a challenge points you to the Challenges form instead of the Challenges Solved one
Growing Bacteria
-
- Forum Admin
- Posts: 496
- Joined: Sat May 28, 2011 9:14 am
- Location: Germany
I'm sorry, but I can't get how could in 8 days be 47 population. I have written a script which gives:
day: 1 - bacts: 0,1,0,0,0 - sum: 1
day: 2 - bacts: 1,0,1,0,0 - sum: 2
day: 3 - bacts: 1,1,0,1,0 - sum: 3
day: 4 - bacts: 1,1,1,0,1 - sum: 4
day: 5 - bacts: 2,1,1,1,0 - sum: 5
day: 6 - bacts: 2,2,1,1,1 - sum: 7
day: 7 - bacts: 3,2,2,1,1 - sum: 9
day: 8 - bacts: 4,3,2,2,1 - sum: 12
day: 9 - bacts: 5,4,3,2,2 - sum: 16
the array of bacts is the succession of days (batters at 1st day of life, batters at 2nd etc...)
What have I done wrong?
p.s. day 0 is 1,0,0,0,0
day: 1 - bacts: 0,1,0,0,0 - sum: 1
day: 2 - bacts: 1,0,1,0,0 - sum: 2
day: 3 - bacts: 1,1,0,1,0 - sum: 3
day: 4 - bacts: 1,1,1,0,1 - sum: 4
day: 5 - bacts: 2,1,1,1,0 - sum: 5
day: 6 - bacts: 2,2,1,1,1 - sum: 7
day: 7 - bacts: 3,2,2,1,1 - sum: 9
day: 8 - bacts: 4,3,2,2,1 - sum: 12
day: 9 - bacts: 5,4,3,2,2 - sum: 16
the array of bacts is the succession of days (batters at 1st day of life, batters at 2nd etc...)
What have I done wrong?
p.s. day 0 is 1,0,0,0,0
-
- Posts: 3
- Joined: Sun Oct 17, 2010 6:00 pm
I think I've programmed the correct algorithm, but is the only way to figure out the answer by iterate ???
Code: Select all
while (amount < 1000000000000);
I'm not going to Fib, Lucas can solve it with a closed-form equation.Luk.Online wrote:I think I've programmed the correct algorithm, but is the only way to figure out the answer by iterate???Code: Select all
while (amount < 1000000000000);
-
- Posts: 3
- Joined: Sun Oct 17, 2010 6:00 pm
-
- Posts: 1
- Joined: Mon Jun 29, 2015 7:50 am
My solution to this was simply to write a C# app and keep track of the number of bacteria on each specific day.
So each day iteration would basically be the number of day 5 bacteria (those dead) increased by the amount from the previous day, so day 4 become day 5, day 3 become day 4, day 2 become day 3, day 1 become day 2, and day 1 is the addition of day 2+3 since those days result in new bacteria.
The total alive is just day 1+2+3+4 and the total dead is just the size of day 5
The code looks like this, you can simply hit enter to generate each new day and you'll see the totals and then skip through the days until you reach one high enough, or you could modify the code to just keep looping until the total count condition is met, I made this more general, you can put a different starting number in for example.
So each day iteration would basically be the number of day 5 bacteria (those dead) increased by the amount from the previous day, so day 4 become day 5, day 3 become day 4, day 2 become day 3, day 1 become day 2, and day 1 is the addition of day 2+3 since those days result in new bacteria.
The total alive is just day 1+2+3+4 and the total dead is just the size of day 5
The code looks like this, you can simply hit enter to generate each new day and you'll see the totals and then skip through the days until you reach one high enough, or you could modify the code to just keep looping until the total count condition is met, I made this more general, you can put a different starting number in for example.
Code: Select all
-
- Forum Admin
- Posts: 496
- Joined: Sat May 28, 2011 9:14 am
- Location: Germany
So I just solved this using
Yet I am curious about the "simple algebraic" and Fibonacci solutions, anyone mind PMing me those solutions?
Code: Select all
while (population < 1000000000000)
growBacteria()
...
-
- Posts: 58
- Joined: Thu Nov 29, 2012 7:45 pm
- Location: Germany
As soon as you solved the challenge, you have access to the solution forum: http://www.hacker.org/forum/viewtopic.p ... c&start=15