#TCTM6451. Epidemiology
0
Epidemiology
Epidemiology
题目描述
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 R 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 P 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.) 流行病学研究者使用模型来分析疾病的传播。在这个问题中,我们使用一个简单的模型。当一个人患有疾病时,他们会在紧接着的下一天感染恰好 R 个人。每个人不会被感染超过一次。我们需要确定总共有超过 P 人患病的那一天。
(此问题是在当前冠状病毒爆发之前设计的,我们承认当前全球许多人正因此病和其他疾病而遭受痛苦。我们希望在此时包含此问题能够突显计算机科学和数学在解决现实世界问题中的重要作用。)
输入格式
There are three lines of input. Each line contains one positive integer. The first line contains the value of P. The second line contains N, the number of people who have the disease on Day 0. The third line contains the value of R. Assume that $P ≤ 10^7$ and $N ≤ P$ and $R ≤ 10$. 有三行输入,每行包含一个正整数。- 第一行包含
P的值。 - 第二行包含
N,即在第0天患有疾病的人数。 - 第三行包含
R的值。
输出格式
Output the number of the first day on which the total number of people who have had the disease is greater than P.输出患病总人数超过 P 的第一天的天数。
750
1
5
4
10
2
1
5
提示
#### 数据范围与提示 Explanation of Output for Sample Input 1 The $1$ person on Day $0$ with the disease infects $5$ people on Day $1$. On Day $2$, exactly $25$ people are infected. On Day $3$, exactly $125$ people are infected. A total of `1 + 5 + 25 + 125 + 625 = 781` people have had the disease by the end of Day $4$ and $781 > 750$.P ≤ 10^7
N ≤ PR ≤ 10
对于样例输入1的解释:
- 第0天有1人患病,他/她在第1天感染了5个人。
- 第2天,恰好有25人被感染。
- 第3天,恰好有125人被感染。
- 到第4天结束时,总共有
1 + 5 + 25 + 125 + 625 = 781人患过病,且781 > 750。