Honey Bees - 1 Point
Bzzzz.....Stay away if you're allergic to bees!...Bzzz
Your mission...calculate honey production! A given hive contains
a number of bees, and a bee that belongs to a hive can either collect
pollen or make honey. A single pollen collecting Honey Bee collects a
certain amount of pollen based on the time of day, and a single honey producing
Honey Bee can produce a certain amount of honey based on the time of day.
The ratio of pollen needed to produce honey is 1:1, so 1 unit of pollen is
needed to produce 1 unit of honey. Your job, given the information for a
part of the day, is to calculate the honey store after that time period.
Pollen Bees
You can assume that the pollen collecting bees make a deposit at
the end of their hour. That is, the pollen they collect is available
all at once, after an hour of working.
Honey Bees
You can assume that if a single honey bee doesn't have enough pollen
for the hour, they're too lazy, and will produce no honey for that hour.
That is, if a honey bee can produce 4 units of honey, they would need
4 units of pollen, and if they don't have that at the beginning of an hour,
they will use no pollen and produce no honey.
Note: Time is in 24-hour format, and 6:00 to 18:00 is daytime.
Input Format
The input will be given with the following information:
Note that each set of < > is a number
// Hive information
<# of bees in the hive> <# of bees collecting pollen>
<Daytime pollen collection rate for a single bee (units of pollen
per bee/hour)>
<Nightime pollen collection rate for a single bee (units of pollen
per bee/hour)>
<Daytime honey production rate for a single bee (units of honey
per bee/hour)>
<Nightime honey production rate for a single bee (units of honey
per bee/hour)>
// Period Information
<Beginning pollen store (units of pollen stored)> <Beginning
honey store (units of honey stored)>
<Start Time> <End Time>
A -1 indicates the end of a period
A double -1 will be signal the end of the input.
The input file will be called jin05.txt.
Output Format
The output should report the total honey store after the period.
Example
Input
100 25
1
3
1
2
75 0
0600 0700
-1
-1
Output
The bees have 75 units of honey.