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?

Input Format

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 Format

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

Sample Input

1 4 3
8 14 10

Sample Output

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.

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 23, 2018
Author: SourSpinach

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...