Woburn Challenge 2017-18 Round 2 - Junior Division
The evil wizard Saruman is breeding himself an army of fearsome Uruk-hai soldiers. Each Uruk-hai can be created out of ~M_u~ men, ~O_u~ orcs, and ~L_u~ litres of mud ~(1 \le M_u, O_u, L_u \le 1\,000)~.
Saruman has at his disposal ~M_s~ men, ~O_s~ orcs, and ~L_s~ litres of mud ~(1 \le M_s, O_s, L_s \le 1\,000)~.
What's the maximum number of Uruk-hai that Saruman can create without exceeding his resources?
The first line of input consists of three space-separated integers,
~M_u~, ~O_u~, and ~L_u~.
The next line consists of three space-separated integers, ~M_s~, ~O_s~, and ~L_s~.
Output a single integer, the maximum number of Uruk-hai that can be created.
1 4 3 8 14 10
Creating ~3~ Uruk-hai requires ~3~ men, ~12~ orcs, and ~9~ litres of mud, which doesn't exceed Saruman's resources. However, he would not be able to create ~4~ Uruk-hai.