CCC '20 J2 - Epidemiology
View as PDFCanadian Computing Competition: 2020 Stage 1, Junior #2
People who study epidemiology use models to analyze the spread of disease. In this problem, we use a simple model.
When a person has a disease, they infect exactly  other people but only on the very next day. No person is infected more than once. We want to determine when a total of more than 
 people have had the disease.
(This problem was designed before the current coronavirus outbreak, and we acknowledge the distress currently being experienced by many people worldwide because of this and other diseases. We hope that including this problem at this time highlights the important roles that computer science and mathematics play in solving real-world problems.)
Input Specification
There are three lines of input. Each line contains one positive integer. The first line contains the value of . The second line contains 
, the number of people who have the disease on Day 
. The third line contains the value of 
. Assume that 
 and 
 and 
.
Output Specification
Output the number of the first day on which the total number of people who have had the disease is greater than .
Sample Input 1
750
1
5
Output for Sample Input 1
4
Explanation of Output for Sample Input 1
The  person on Day 
 with the disease infects 
 people on Day 
. On Day 
, exactly 
 other people are infected. On Day 
, exactly 
 other people are infected. A total of 
 people have had the disease by the end of Day 
 and 
.
Sample Input 2
10
2
1
Output for Sample Input 2
5
Explanation of Output for Sample Input 2
There are  people on Day 
 with the disease. On each other day, exactly 
 other people are infected. By the end of Day 
, a total of exactly 
 people have had the disease and by the end of Day 
, more than 
 people have had the disease.
Comments
the question might be a bit incorrectly phrased, really its the current number of people infected multiplies by R (e.g. 1 x 5, then 5 x 5, then 25 x 5 for the first example) each day after day 1. hope this helps!
A big source of confusion for me was whether a person infects
 others every day or just on the next day. This becomes obvious after you study the sample outputs, but the original wording could be clearer by stating that each newly infected person infects 
 people only once—specifically on the day immediately after they become infected—and never again after that. Here's how I would've worded it:
You are given three integers
, 
, and 
.
On Day
, exactly 
 people start off infected.
Each person who becomes infected infects exactly
 new people on the very next day and then does not infect anyone again after that.
Let "total infected so far" be the number of unique people who have been infected up to and including a given day.
Task: Determine the first day
 (starting with Day 
) for which the total infected so far exceeds 
.
Input Specification:
Output Specification: Output the integer
 such that the total infected count first becomes greater than 
 at the end of Day 
.
Whether using Python or C++, this problem is a bit difficult to analyze. If you are using C++ you can try to give the start num(in example 1 is 1) to total before your "while".
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Only in Canada will you have contest organizers apologize for a pandemic that they didn't know would happen.
meanwhile USACO made COWVID-19 themed problems
An important lesson I have learned. Don't forget to delete the code you write to check new values.
I lost half an hour trying to find out why my answer was correct, and then I noticed I had some print statements to check the values.
It's a very interesting challenge though.
This question was surprisingly difficult compared to the other questions during this years contest
This comment is hidden due to too much negative feedback. Show it anyway.