The headwaters of the Yellowstone River are at Yount Peak. Many creeks flow into the Yellowstone River, for example, Otter Creek, Elk Antler Creek, Cabin Creek, and Thorofare Creek. The amount of water flowing through each creek and entering the Yellowstone depends on the time of day and the time of year.
You want to deterine how much water flows over the Lower Falls of the Yellowstone River at 8:00 PM, prime sunset viewing time.
It takes some time for the water to flow from the confluence of the creek to the falls - 1 mile per hour.
The input contains 2 kinds of data for one day - the distance from the river to the falls and the rate at a given time.
Suppose there were only 2 creeks (Otter and Thorofare) and they had these rates:
Creek | Distance | Time | Rate |
---|---|---|---|
Otter Creek | 1 mile | 18:00 | 900 gallons per minute |
Otter Creek | 1 mile | 19:00 | 1000 gallons per minute |
Otter Creek | 1 mile | 20:00 | 1100 gallons per minute |
Thorofare Creek | 5 miles | 14:00 | 600 gallons per minute |
Thorofare Creek | 5 miles | 15:00 | 750 gallons per minute |
Thorofare Creek | 5 miles | 16:00 | 700 gallons per minute |
Because Otter Creek is 1 mile upstream from the falls, the water from 7:00 PM arrives at the falls at 8:00 PM. Thorofare Creek is 5 miles way, so the water at 15:00 arrives at the falls at 8:00 PM. The total rate is 1000 + 750 = 1750 gallons per minute.
What is the total amount of water going over the falls at 8:00 PM, in gallons per minute?Copyright 2022 Robin A. Reynolds-Haertle