2022-04-23 20:51:38 +02:00
|
|
|
|
# cakes-swerc-2020-2021
|
|
|
|
|
|
2023-07-02 17:28:54 +02:00
|
|
|
|
Created by [@theoludwig](https://github.com/theoludwig) on 23 April 2022.
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
2023-01-04 17:28:00 +01:00
|
|
|
|
- **Line 1:** Single integer `N` for the number of ingredients.
|
|
|
|
|
- **`N` next lines:** One for each ingredient. Each of these lines contains two positive integers:
|
2023-10-23 23:16:24 +02:00
|
|
|
|
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.
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
### Output
|
|
|
|
|
|
|
|
|
|
The output should contain a single integer: the maximum number of cakes you can make using the
|
|
|
|
|
available ingredients.
|
|
|
|
|
|
2023-08-21 23:52:03 +02:00
|
|
|
|
### Constraints
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
2023-08-27 15:09:31 +02:00
|
|
|
|
- $$1 \leq N \leq 10$$
|
2023-08-21 23:52:03 +02:00
|
|
|
|
- All ingredient quantities will be integers between 1 and 10 000.
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
## Source
|
|
|
|
|
|
2023-08-21 23:11:08 +02:00
|
|
|
|
[SWERC 2020–2021 - Problem E: Cake](https://swerc.eu/2020/problems/)
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
|
|
See the `test` folder for examples of input/output.
|
|
|
|
|
|
|
|
|
|
### Example 1
|
|
|
|
|
|
|
|
|
|
#### Input
|
|
|
|
|
|
|
|
|
|
```txt
|
|
|
|
|
3
|
|
|
|
|
100 500
|
|
|
|
|
2 5
|
|
|
|
|
70 1000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Output
|
|
|
|
|
|
|
|
|
|
```txt
|
|
|
|
|
2
|
|
|
|
|
```
|
|
|
|
|
|
2022-04-23 21:47:58 +02:00
|
|
|
|
### Example 2
|
2022-04-23 20:51:38 +02:00
|
|
|
|
|
|
|
|
|
#### Input
|
|
|
|
|
|
|
|
|
|
```txt
|
|
|
|
|
3
|
|
|
|
|
100 50
|
|
|
|
|
2 5
|
|
|
|
|
70 1000
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
#### Output
|
|
|
|
|
|
|
|
|
|
```txt
|
|
|
|
|
0
|
|
|
|
|
```
|