Cars on the bridge
A convoy of trucks needs to cross a bridge that is lb meters long. Each truck measures la meters in length and weighs w kilonewtons (kN). The minimum required distance between any two trucks is mindist meters. The bridge can support a maximum load of strength kN at any given time. Your task is to determine the maximum number of trucks, res, that can be on the bridge simultaneously, given these constraints. Note that if any part of a truck is on the bridge, the entire truck is considered to be on it.
Input Data
You will receive space-separated values for lb, la, mindist, strength, w from the standard input. The constraints are as follows: 50 ≤ lb ≤ 700, 5 ≤ la ≤ 15, 15 ≤ mindist ≤ 50, 400 ≤ strength ≤ 5000, 100 ≤ w ≤ 500.
Output Data
Print the maximum number of trucks, res, that can be on the bridge at the same time.