#P13815. [CERC 2022] Skills in Pills
[CERC 2022] Skills in Pills
题目描述
An unnamed protagonist of this task received amazing e-mail offers for wondrous pills that will enhance their cognitive and all other sorts of abilities. After carefully analysing all offers and side effects, he has decided that he will order 2 types of pills, let's call them and . He needs to take pill every days and pill every days. He will follow this meticulously over the next days.
More formally, in the next days, there should be no consecutive days where he does not take pill and no consecutive days where pill is not taken. However, there is a twist – the two pills are highly potent and must not be taken on the same day, lest horrible side effects should happen. Given this constraint, what is the smallest number of pills that he needs to take to meet these requirements?
输入格式
You are given three space-separated integers, , , and .
输出格式
Print one number – the minimum number of pills that need to be taken. It is easy to prove that a solution always exists for the given constraints.
2 3 8
6
2 3 11
9
3 7 100
48
提示
Comment
In the first case, we can take pill on days , , , and , and pill on days and , giving the sequence . In the second case, the best approach is to take pills in sequence , which requires taking pills.