Problem 43109. How many complete pizzas (number 2)
x is a vector with numbers of pizza slices. A corresponding vector n indicates in how many slices the pizza slices of x were cut and t is a vector indicating the type of pizza (e.g. 1 is a margarita, 2 is a peperoni, etc.). How many complete pizzas do we have, when we cannot join 2 different pizzas?
Example:
x = [1 3 12]; n = [2 6 8]; t = [1 2 1];
in the first column we have on slice (x=1) from a pizza margarita (t=1) cut in half (n=2) -> half a pizza margarita. in the second column we have 3 slices (x=3) from a peperoni pizza (t=2) cut in 6 slices (n=6) -> so half a peperoni pizza. in the third column we have 12 slices of a margarita pizzas (t=1) cut in 8 slices ->1.5 slices margarita pizza.
so we can combine this to 2 pizza margaritas and 0.5 peperoni pizza. So in total we can combine 2 pizzas.
Solution Stats
Problem Comments
-
1 Comment
The test suite has been fixed and is now solvable without hacking.
Solution Comments
Show commentsProblem Recent Solvers21
Suggested Problems
-
Find the sum of all the numbers of the input vector
50695 Solvers
-
13587 Solvers
-
Make an awesome ramp for a tiny motorcycle stuntman
683 Solvers
-
Flip the main diagonal of a matrix
841 Solvers
-
How long do each of the stages of the rocket take to burn?
330 Solvers
More from this Author25
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!