#C6135. Bacteria Growth Simulation
Bacteria Growth Simulation
Bacteria Growth Simulation
In this problem, you are given an initial number of bacteria n that grows over a period of d days. You are also given a temperature series of length t. On each day, if the temperature is within the splitting range \( [r_{low}, r_{high}] \), then each bacterium splits and doubles the total count.
Formally, if on day \( i \) (for \( i=1,2,\ldots,\min(d, t) \)) the temperature \( T_i \) satisfies \( r_{low} \leq T_i \leq r_{high} \), the number of bacteria is updated as:
\[ n_{new} = 2 \times n_{current} \]Your task is to compute the total number of bacteria after \( d \) days.
inputFormat
The input is given in two lines:
- The first line contains five space-separated integers: n (initial number of bacteria), d (number of days), t (size of the temperature array), r_low and r_high (the inclusive temperature range for splitting).
- The second line contains t space-separated integers representing the temperature for each day.
Note that only the first \(\min(d, t)\) temperatures will be used in the simulation.
outputFormat
Output a single integer representing the total number of bacteria after \( d \) days.
## sample3 5 5 15 25
20 15 25 30 18
48