| ||Feudalia's military is preparing a preemptive strike against Banania's military installations. Feudalia has a number of missile silos. Each silo has an unlimited number of missiles at its disposal, but can only fire a single missile at a time. When a missile is fired, it requires takeOffTime seconds before it can take off from its silo. Once it takes off, it requires distance/missileSpeed minutes to reach its target, where distance is the Euclidean distance between the silo and the target. When the missile reaches its target, the target is instantly destroyed. After a missile takes off, its silo requires rechargeTime minutes of preparation before it can launch another missile.|
The general has ordered you to destroy all of Banania's military bases in as little time as possible. You are given ints siloX, siloY, baseX and baseY which determine the locations of the missile silos and bases. Feudalia's i-th missile silo is located at (siloX[i], siloY[i]) and Banania's j-th base is located at (baseX[j], baseY[j]). Return the minimum time in minutes required to destroy all enemy bases.
|Parameters:||int, int, int, int, int, int, int|
|Method signature:||double getMinimumTime(int baseX, int baseY, int siloX, int siloY, int takeOffTime, int rechargeTime, int missileSpeed)|
|(be sure your method is public)|
|-||The returned value must be accurate to within a relative or absolute value of 1E-9.|
|-||takeOffTime will be between 1 and 60, inclusive.|
|-||rechargeTime will be between 5 and 1000, inclusive.|
|-||missileSpeed will be between 1 and 2000, inclusive.|
|-||baseX will contain between 1 and 50 elements, inclusive.|
|-||baseY will contain the same number of elements as baseX.|
|-||siloX will contain between 1 and 50 elements, inclusive.|
|-||siloY will contain the same number of elements as siloX.|
|-||Each element of baseX, baseY, siloX and siloY will be between 0 and 1000000, inclusive.|
|-||The locations for each base and silo will be distinct.|
|An optimal strategy would be:
00:00 : The silo at (50,50) launches an attack against the base at (0,0).
00:30 : The first missile finishes taking off.
20:30 : The silo at (50,50) launches its second missile, this time against the base at (0,50).
21:00 : The second missile finishes taking off.
41:30 : The silo at (50,50) launches its third missile, this time against the base at (50,0).
71:00 : The second missile hits the base at (0,50) (The distance was 50).
71:12.6 (Approx.) : The first missile hits the base at (0,0) (The distance was 70.710678119).
91:30 : The third missile hits the remaining base.
|Since it now takes 15 hours to prepare a new missile, using the same silo against the three enemy bases is no longer the optimal strategy. Instead, each of the silos at (0,1000) and (1000,0) should target the closest base while the silo at (50,50) targets the base at (0,0).|