Selasa, 10 Januari 2017

UVA 11000 - Bee Solution

Problem Statement: Bee

Explanation

Simulate the process to get a better understanding of the problem.

  • Female bees give birth to one male bees.
  • Male bees give birth to one male bees and one female bees.
  • There's an immortal female bee.
From the statement above we can form this equation,
  • m[i] = m[i-1] + f[i-1], number of male equal to number of male and female in previous year.
  • f[i] = m[i-1] + 1, number of female equal to number of male in previous year, and plus one because of female immortal bee.
Source Code

Tidak ada komentar:

Posting Komentar