Half-Life

Problem #100

Tags: biology

Who solved this?

Previous:Elo Ratings Next:Blood Type


The concept of Half-Life is not a difficult one to understand - there is some value X which steadily decreases such that the value repeatedly halves after some time interval t_h called the "half-life". For example, given t_half = 1 second and some initial value x_0 = 160, then observe below how the value decreases:

time elapsed |   0 |  1 |  2 |  3 |  4 |  5 |   6 |    7 | ... |
       value | 160 | 80 | 40 | 20 | 10 |  5 | 2.5 | 1.25 | ... |

This type of pattern has application in real-world fields such as the Radioactive Decay of isotopes. Take for example the element Iodine, which typically has 53 protons and 76 neutrons and has a half-life of around 16 million years. If you have 1 gram of Iodine today, then in 16 million years from now you will only have 0.5 grams of Iodine (the rest decaying into Xenon, in this case).

However, that's only the case for Iodine atoms having 76 neutrons, called "Iodine-129". Sometimes Iodine atoms can have 78 neutrons, called "Iodine-131", and Iodine-131 atoms are very unstable, having a half-life of only 8 days!

But, what about if we wanted to calculate a value between half-life intervals? For example, at 5.5 days? We would encourage you to derive the full equation yourself, but for the sake of getting on with the problem we'll provide it here:

$$\Huge X_t = X_0 \cdot 2^{-({t}/{t_h})}$$

where X_t is the value at the end of the time interval, X_0 is the value at the beginning of the time interval, t is the time elapsed, and t_h is the half-life.

Another process which behaves similarly is drug concentration in the body, where some quantity of ingested drug enters the bloodstream and is then gradually expelled (usually by "waste") following a half-life dynamic.

Problem Statement

John has just returned from the doctor, who perscribed him a brand new medication and instructed John to take one tablet each day. The doctor also told John that its critical he takes the medication regularly as it needs to slowly build up in his system before it becomes effective.

Input Data
First line is Q, the quantity of testcases.
Q lines then follow, each in the format D H A.

Answer
Should consist of Q space-separated integers, corresponding to the day at which the amount of medication in John's body first reaches A.
Assume that John takes his first dose on day 1, and takes each subsequent dose exactly 1 day apart.
Also assume that the entire dose immediately enters John's bloodstream upon ingestion.

Example

input data:
2
1 1 1
123 456 789

answer:
1 8
You need to login to get test data and submit solution.