Pizzanomicón 

Some fragments of the most important cookery book ever, the
Pizzamonicon.

“Four are the pillars that a good pizza is founded in: the honesty of
the dough, the quality of the mozzarela, the courage of the ingredients,
and the wisdom of the oven.”

“Buy the raw dough of bread in a bakery, give yourself the holy shape of
disk. Use a little bit of flour to avoid that it sticks. You will obtain
a good dough and very, very cheap. Remember that eating frozen pizza
dough is a sin.”

“Do not save money with the mozzarela, if you use mozzarela to melt, as
well as if you choose mozzarela di bufala. Using cheap mozzarela is a
sin.”

“Use those ingredients that can be eaten war (anchovies, cold meats,
pinapple...) or those one that, cutting them thin, need a little cooking
(mushrooms, bacon...) Using preserve mushrooms, being able to buy them
fresh, is a sin.”

“Put the oven at maximal power. Know your oven: depending on the type of
dough, its thickness, the type of oven, your pizza tray, and if you put
it cold or warm on the oven, your pizza will last more or less to be
done. You must discover the magic number of minutes φ that are needed to
cook perfectly your pizza in your oven. Test: prepare various identical
pizzas, and cook them one by one different quantities n of minutes,
until you find the exact point.”

In order to follow this last advice to the letter, I have prepared a big
quantity of pizzas to cook on my barbeque. As I do not know the time
that my barbeque lasts to cook a pizza, I will follow the next process:

- I put a pizza on the barbeque.

- I wait a number n of minutes.

- I remove the pizza, and wait exactly t minutes in order to the pizza
  has the optimal temperature to be tasted.

- I taste the pizza.

I last t + n minutes applying these steps, in the end I will discover:

- Pizza is perfect: n = φ.

- Pizza is underdone: n < φ.

- Pizza is burnt: n > φ.

Assuming that I previously know that using n = a minutes I will obtain
an underdone pizza, and that using n = b minutes I will burn the pizza,
discover which process I should follow to find the magic constant φ. In
particular, I ask you to write a program that, given a, b and t,
discovers a strategy that minimizes the number of minutes M that I will
loose cooking pizzas to discover φ, in the worst situatation
contemplated by the strategy. Your program must print the number of
minutes that I will loose if this circunstance is given

For instance, if b = a + 2, is obvious that φ = n, for this reason the
answer is M = 0. If b = a + 3, I will have to cook at least a pizza to
know how many is φ, so that M = a + 1 + t (if I have to cook a pizza, is
better to try the one that lasts less time). If b = a + 4, then
M = a + 2 + t (if I chose n = a + 1 and the pizza was underdone, I would
not know if the answer is φ = a + 2 or φ = a + 3, so that I would have
to cook a second pizza). When b > a + 4, in the worst case I will have
to prepare two pizzas, and the calculations are more complicated. In
particular, the time t has importance: it can be preferable to cook 2
pizzas little time than 1 pizza long time.

Input

A non empty sequence of lines, each one of them corresponds to the 3
values t, a and b of a case, separated by spaces. Is is fulfilled that
0 ≤ t ≤ 200, 0 ≤ a < b ≤ 200 and b − a > 1.

Output

Your program must print in a line for each case the number of minutes
that I will last to discover φ, assuming that I follow a strategy that
minimizes this number.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:19:50.352Z

© Jutge.org, 2006–2026.
https://jutge.org
