Skills in Pills
시간 제한1초메모리 제한1024 MB
n일 동안 약 A는 k일 연속 공백이 없게, 약 B는 j일 연속 공백이 없게 복용하되 같은 날 복용하지 않도록 하면서 최소 복용 횟수를 구한다.
문제
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.
제한
힌트
In the first case, we can take pill A on days , , , and , and pill on days and , giving the sequence .ABAABA. In the second case, the best approach is to take pills in sequence .ABAABAABA. which requires taking 9 pills.