All problems

Problem 857

Poor Pigs

Hard · 30 pts · Math, Combinatorics

Problem

Exactly one of BUCKETS buckets contains poison. A pig that drinks from a poisoned bucket dies MINUTESTODIE minutes later, and you have MINUTESTOTEST minutes in total, so there are T = MINUTESTOTEST / MINUTESTODIE rounds of testing. Find the minimum number of pigs needed to identify the poisoned bucket. Each pig can end in T + 1 states (it dies in one of T rounds, or survives), so P pigs distinguish (T + 1)^P buckets.

Input

A single line with BUCKETS, MINUTESTODIE and MINUTESTOTEST.

Output

Print the minimum number of pigs.

Constraints

1 <= BUCKETS <= 1000; 1 <= MINUTESTODIE <= MINUTESTOTEST <= 100

Example input

4 15 15

Example output

2

Explanation

With 4 buckets and one round of testing (15 and 15 minutes), each pig is either dead or alive afterwards, so 2 pigs give 2 × 2 = 4 outcomes, enough for 4 buckets.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Mirror Reflection Next: Sum of Square Numbers