WC '17 Contest 2 J2 - Breeding an Army

View as PDF

Submit solution


Points: 3
Time limit: 1.0s
Memory limit: 16M

Author:
Problem types
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 Mu men, Ou orcs, and Lu litres of mud (1Mu,Ou,Lu1000).

Saruman has at his disposal Ms men, Os orcs, and Ls litres of mud (1Ms,Os,Ls1000).

What's the maximum number of Uruk-hai that Saruman can create without exceeding his resources?

Input Specification

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 Specification

Output a single integer, the maximum number of Uruk-hai that can be created.

Sample Input

Copy
1 4 3
8 14 10

Sample Output

Copy
3

Sample Explanation

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.


Comments

There are no comments at the moment.