We are thirsty but not smart!
Statement
Goal
There are 3 individuals that need to bring a bucket of water through a distance of 100 meters. All 3 are split along the 100 meters.John starts at the 0 meter mark and has the bucket of water, he walks at a constant speed of S1 m/s.
Claire is waiting for him at the 40-meter mark, when John reaches her, he gives her the bucket and she moves towards A.A.Ron reaching him 20 meters later at a constant speed of S2 m/s.
After she meets A.A.Ron he gets on his bike with the bucket and rides.
A.A.Rons bike goes at a constant speed of S3 m/s but halfway he falls and has to run at half the speed he was going on the bike still carrying the bucket.
Every quarter of the 20 meters he stops for air because he is fat.
He waits T -1 seconds every time he stops.
How much time the does group take to bring the water to the 100-meter mark?
Time = Distance/Velocity
Input
S1 is the speed of John in meters per second.
S2 is the speed of Claire in meters per second
S3 is the speed of A.A.Ron in meters per second
T is the initial time A.A.Ron wastes
Input format "S1,S2,S3,T"
S2 is the speed of Claire in meters per second
S3 is the speed of A.A.Ron in meters per second
T is the initial time A.A.Ron wastes
Input format "S1,S2,S3,T"
Output
Returns the time it takes to carry the bucket 100 meters.
Format is "_m:_s"
Format is "_m:_s"
Constraints
1 ≤ S1 ≤ 5
1 ≤ S2 ≤ 3
1 ≤ S3 ≤ 10
1 ≤ T ≤ 8
1 ≤ S2 ≤ 3
1 ≤ S3 ≤ 10
1 ≤ T ≤ 8
Example
Input
1,1,1,3
Output
3m:6s
Game modes
Fastest, Shortest
Test cases
Test 1 Test
Input
1,1,1,3
Output
3m:6s
Validator 1 Validator
Input
3,3,5,7
Output
1m:11s
Test 2 Test
Input
1,2,3,4
Output
1m:39s
Validator 2 Validator
Input
5,2,10,8
Output
1m:6s
Test 3 Test
Input
4,3,1,1
Output
2m:17s
Validator 3 Validator
Input
4,3,1,1
Output
2m:17s
Test 4 Test
Input
4,3,1,1
Output
2m:17s
Validator 4 Validator
Input
1,2,3,4
Output
1m:39s
Solution language
Solution
Stub generator input