Woburn Challenge 2017-18 Round 2 - Junior Division
Problem 2: Breeding an Army
The evil wizard Saruman is breeding himself an army of fearsome Uruk-hai soldiers. Each Uruk-hai can be created out of Mu men, Ou orcs, and Lu litres of mud (1 ≤ Mu, Ou, Lu ≤ 1000).
Saruman has at his disposal Ms men, Os orcs, and Ls litres of mud (1 ≤ Ms, Os, Ls ≤ 1000).
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, Mu, Ou, and Lu.
The next line consists of three space-separated integers, Ms, Os, and Ls.
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.
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 23, 2018
PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11