1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00

feat(challenges): add cakes-swerc-2020-2021

This commit is contained in:
Divlo 2022-04-23 20:51:38 +02:00
parent 104c61935a
commit 112a141caa
No known key found for this signature in database
GPG Key ID: 8F9478F220CE65E9
20 changed files with 142 additions and 0 deletions

View File

@ -0,0 +1,73 @@
# cakes-swerc-2020-2021
Created by [@Divlo](https://github.com/Divlo) on 23 April 2022.
## 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
- **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:
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.
### Limits
- 1 <= `N` <= 10
- All ingredient quantities will be integers between 1 and 10 000
## Source
- [SWERC 20202021 - Problem E: Cake](https://swerc.eu/2020/problems/)
## Examples
See the `test` folder for examples of input/output.
### Example 1
#### Input
```txt
3
100 500
2 5
70 1000
```
#### Output
```txt
2
```
### Example 1
#### Input
```txt
3
100 50
2 5
70 1000
```
#### Output
```txt
0
```

View File

@ -0,0 +1,4 @@
3
100 500
2 5
70 1000

View File

@ -0,0 +1 @@
2

View File

@ -0,0 +1,4 @@
3
100 50
2 5
70 1000

View File

@ -0,0 +1 @@
0

View File

@ -0,0 +1,2 @@
1
1 1

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,3 @@
2
1 5000
5 10000

View File

@ -0,0 +1 @@
2000

View File

@ -0,0 +1,3 @@
2
1 5000
6 10000

View File

@ -0,0 +1 @@
1666

View File

@ -0,0 +1,11 @@
10
173 1561
416 3733
449 3063
1207 7353
520 3024
910 6063
687 4589
1779 9402
1115 5874
819 5083

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1,11 @@
10
336 3217
923 6730
568 5620
154 1446
1069 9055
976 5941
561 3259
474 3121
983 7153
739 4827

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1,11 @@
10
660 5741
983 9463
518 4992
1096 9177
713 6122
509 3658
463 3259
242 2284
195 1609
1130 8178

View File

@ -0,0 +1 @@
7

View File

@ -0,0 +1,11 @@
10
2 2815
1 1438
3 4158
5 6799
5 6638
3 5753
5 9420
2 4404
1 2165
1 2136

View File

@ -0,0 +1 @@
1327