COVID-19
Description:
A new virus attacks martians. They ask Earth scientists how long will pandemy last on their planet. The overall ammount of their population is Y and there are already X infected among them. Silly martians don't stick to quarantine and continue to hang out with each other, which makes it easier for the virus to spread. Every day each infected martian spreads the disease to N other healthy martians. Luckily the virus is not lethal and it takes D days for an infected martian to recover. After that he becomes immune to the virus and doesn't infect others.
Your job is to determine how many days will pass until there are no infected on the planet.
Example:
X = 1, Y = 5, N = 1, D = 3
Day 0: 1 infected / 4 healthy / 0 recovered
Day 1: 2 infected / 3 healthy / 0 recovered
Day 2: 4 infected / 1 healthy / 0 recovered
Day 3: 4 infected / 0 healthy / 1 recovered
Day 4: 3 infected / 0 healthy / 2 recovered
Day 5: 1 infected / 0 healthy / 4 recovered
Day 6: 0 infected / 0 healthy / 5 recovered
The answer is 6 days.
Please note that some of the variables can be 0 and X will always be not greater than Y.
Stats:
Created | May 17, 2020 |
Published | May 17, 2020 |
Warriors Trained | 193 |
Total Skips | 57 |
Total Code Submissions | 152 |
Total Times Completed | 34 |
C# Completions | 34 |
Total Stars | 4 |
% of votes with a positive feedback rating | 75% of 16 |
Total "Very Satisfied" Votes | 10 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 12 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |