### PROBLEM LINK:

**Author:** Kaushik Iska

**Tester:** Mahbub

**Editorialist:** Jingbo Shang

### DIFFICULTY:

Simple

### PREREQUISITES:

Programming Language

### PROBLEM:

Define **F[1] = S, F[i > 0] = F[i - 1] * (C + 1)**. Determine whether **F[D] >= L**.

### EXPLANATION:

First of all ,we need to observe that **F[]** is monotone increasing, because of (C + 1) > 1.

Second, **F[]** is increasing exponentially, while **L** is smaller than 10^9. That means, only O(**log L**) days are needed for F[D] to exceed **L**.

Third, when F[] exceed **L**, it is possible about 10^18 (exceeding **int** in C++ and Java). So please choose the appropriate type to store.

In summary, what we need to do is calculate **F[0ā¦D]** one by one, until all **D + 1** ones are got or some one is greater than **L**. The time complexity is in O(min{**D**, **log L**}).

### AUTHORāS AND TESTERāS SOLUTIONS:

Authorās solution can be found here.

Testerās solution can be found here.