Problem list
Log in
#icpc00115 · ICPC SWERC 2020

Cakes

Bronze III 1.0 s 2048 MB

1

This summer, you plan to organize a large party and invite many friends. They have a sweet tooth, so you plan to bake nice cakes for them. You know the recipe for a nice chocolate cake, and you want to cook as many of them as possible.

Given the $N$ ingredients needed to make a single cake and the ingredients that you have in your kitchen, how many cakes can you make?

Input

  • The first line of the input contains a single integer $N$.
  • Then, $N$ lines follow, one for each ingredient. Each of these lines contains two positive integers: the first one is the required quantity of this ingredient per cake, the second one is the quantity of this ingredient you have in your kitchen.

Output

The output should contain a single integer: the maximum number of cakes you can make using the available ingredients.

Example 1

Input
3
100 500
2 5
70 1000
Output
2

Example 2

Input
3
100 50
2 5
70 1000
Output
0
Source
ICPC SWERC 2020
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code