mirror of
				https://github.com/theoludwig/programming-challenges.git
				synced 2025-09-11 23:11:21 +02:00 
			
		
		
		
	feat(challenges): add cakes-swerc-2020-2021
				
					
				
			This commit is contained in:
		
							
								
								
									
										73
									
								
								challenges/cakes-swerc-2020-2021/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								challenges/cakes-swerc-2020-2021/README.md
									
									
									
									
									
										Normal 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 2020–2021 - 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 | ||||
| ``` | ||||
							
								
								
									
										0
									
								
								challenges/cakes-swerc-2020-2021/solutions/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								challenges/cakes-swerc-2020-2021/solutions/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										4
									
								
								challenges/cakes-swerc-2020-2021/test/1/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								challenges/cakes-swerc-2020-2021/test/1/input.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| 3 | ||||
| 100 500 | ||||
| 2 5 | ||||
| 70 1000 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/1/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/1/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 2 | ||||
							
								
								
									
										4
									
								
								challenges/cakes-swerc-2020-2021/test/2/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								challenges/cakes-swerc-2020-2021/test/2/input.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| 3 | ||||
| 100 50 | ||||
| 2 5 | ||||
| 70 1000 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/2/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/2/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 0 | ||||
							
								
								
									
										2
									
								
								challenges/cakes-swerc-2020-2021/test/3/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								challenges/cakes-swerc-2020-2021/test/3/input.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | ||||
| 1 | ||||
| 1 1 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/3/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/3/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 1 | ||||
							
								
								
									
										3
									
								
								challenges/cakes-swerc-2020-2021/test/4/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								challenges/cakes-swerc-2020-2021/test/4/input.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| 2 | ||||
| 1 5000 | ||||
| 5 10000 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/4/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/4/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 2000 | ||||
							
								
								
									
										3
									
								
								challenges/cakes-swerc-2020-2021/test/5/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								challenges/cakes-swerc-2020-2021/test/5/input.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | ||||
| 2 | ||||
| 1 5000 | ||||
| 6 10000 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/5/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/5/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 1666 | ||||
							
								
								
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/6/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/6/input.txt
									
									
									
									
									
										Normal 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 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/6/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/6/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 5 | ||||
							
								
								
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/7/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/7/input.txt
									
									
									
									
									
										Normal 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 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/7/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/7/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 5 | ||||
							
								
								
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/8/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/8/input.txt
									
									
									
									
									
										Normal 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 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/8/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/8/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 7 | ||||
							
								
								
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/9/input.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								challenges/cakes-swerc-2020-2021/test/9/input.txt
									
									
									
									
									
										Normal 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 | ||||
							
								
								
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/9/output.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								challenges/cakes-swerc-2020-2021/test/9/output.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| 1327 | ||||
		Reference in New Issue
	
	Block a user