Cody

Problem 44939. What time can I drive after drinking?

At T o'clock, after a hard day of Matlab, I immediately start drinking and treat myself to N pints of tasty beer. Each beer I drink has 3 standard units (strong beer - ~5.2%) and my body processes 1 unit of alcohol each hour (the average). Assume all beer is consumed instantly.

In England the legal limit for driving is approximately 2 units of alcohol in your blood, assuming this at what time can I legally drive again?

The input N is number of beers drank and T the time I start drinking (as a 24 hour integer). The output H is the hour I may drive again (24 hour integer) and the output Y is how many days (where 0 is the same day, 1 is the following day etc).

E.g. If I drink 1 beer (N=1) at 7 pm (T=19), 1 of the units will be processed in 1 hour and I can 'safely' drive with 2 units in my blood. The output is D=0, H=20.

https://www.nhs.uk/common-health-questions/lifestyle/how-long-does-alcohol-stay-in-your-blood/

Solution Stats

85.71% Correct | 14.29% Incorrect
Last solution submitted on Sep 05, 2019