## CCC '20 J2 - Epidemiology

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 512M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
##### Canadian 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 people are infected. On Day , exactly people are infected. A total of people have had the disease by the end of Day are .

#### 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 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.

• commented on Oct. 9, 2020, 9:53 p.m. edited

It's a very interesting challenge though.

• commented on April 3, 2020, 3:59 p.m.

This question was surprisingly difficult compared to the other questions during this years contest

• commented on April 3, 2020, 5:42 p.m.

Not really.

• commented on March 28, 2020, 2:09 p.m.

This comment is hidden due to too much negative feedback. Click here to view it.

• commented on March 28, 2020, 8:16 p.m.

When someone is infected, they infect R other people ONLY on the very next day, not every day after they are infected.

• commented on March 29, 2020, 12:22 p.m.

Kinda doesn't make any sense when you think about it intuitively, but I guess it's what it is.

Like people don't stop infecting others when they've already infected someone, how would they know?