- 0of 0 votes
Mr. Stark is the owner of Stark industries, a manufacturer of weaponry.- anoophky September 06, 2019 in United States
A local Mafia group has hijacked one of the factories in the desert.
The mafias want to transport the weapons from the factory to their base camp, and use a single truck to do it.
But, every kilometer the truck travels with the weapons, one weapon falls off and breaks. The truck can only travel integral values of distance, and will lose 1 weapon for every km travelled.
The weapons can be unloaded at any point from the truck, and can be picked up again later.
Given the number of weapons X, max capacity of the truck Y and distance between the factory and the base Z, find the maximum number of weapons that can be transferred intact from the factory to the mafia base.
findMaxWeapons function takes the following parameters:
X - the number of weapons
Y - max capacity of the truck
Z - distance between the factory and the base
| Report Duplicate | Flag | PURGE
Open Chat in New Window