2014 Mock CCC by Alex and Timothy
Problem J1: Love Overdose
Alice has a crush on her friend Bob, but she is too shy to express it. From an ancient recipe passed down through her family, she has concocted a vial of love potion. She plans to slip this potion into Bob's food every day so he will love her forever. The only problem is that the potion is so potent, taking too much can make Bob overdose, resulting in him being utterly indifferent towards her.
According to a note on the recipe, if some amount of the potion is ingested one day, only 50% percent of that amount is retained in the body on the next day, and 0% of that amount is retained on the day after that. You are given A and B, the amount of love potion in mL that Alice gives to Bob on the first and second day, respectively, and R, the recommended dosage in mL, according to her recipe. Write a program to determine whether Bob overdoses on the first day, the second day, or neither. Note that if Bob overdoses on the first day, he cannot overdose again on the second.
Three lines, containing the three non-negative integers A, B, and R, each no greater than 1000.
If he overdoses on the first day, output "
Bob overdoses on day 1." If he overdoses on the second day, output "
Bob overdoses on day 2." Otherwise, output "
Bob never overdoses."
Sample Input 1
100 200 249
Sample Output 1
Bob overdoses on day 2.
Sample Input 2
50 100 125
Sample Output 2
Bob never overdoses.
For the first example, Alice slips Bob 100 mL of the potion on day one, of which, only 50 mL remain in Bob's body on day two. 50 mL is added on top of the 200 mL that he ingests on day two to make 250 mL, which is barely enough to make him overdose the recommended dosage of 249 mL.
For the second example, the amount from day one reduces to 25 mL on day two, when he is given another 100 mL to yield a total of 125 mL for the second day. 125 mL happens to be just the right dosage, so he does not overdose.
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 27, 2014
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3