Valentine's Day '18 J2 - Stop the Scammer

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Carol has been scammed!

You, as Carol's dear friend, seek justice against this scammer. To do so, you devise a master plan - you will write Medium articles to get attention from the press. However, this is no simple process. Each Medium article you write will receive fewer claps than the previous article, and you must achieve a total of at least N claps to take down the scammer. Your penultimate article will result in a cease and desist, after which you must write an article about receiving the cease and desist - this article will receive the sum of all claps from all previous articles.

Your first article receives X claps, and every subsequent article receives Y claps fewer than the previous article. An article cannot receive a negative number of claps. In that event, it would receive zero claps. What is the minimum number of Medium articles you must write before the cease and desist to achieve at least N claps?

Constraints

1 \le N \le 10^6

1 \le X, Y \le 10^3

Input Specification

The first line will contain N, the number of claps required.

The following line will contain X and Y.

Output Specification

If it's not possible to obtain justice, output RIP.

Otherwise, output the number of articles it will take (excluding the cease and desist article) to obtain justice.

Sample Input 1

1000
400 200

Sample Output 1

2

Sample Input 2

1000
300 20

Sample Output 2

2

Comments


  • 9
    felixzhang25  commented on April 1, 2018, 2:24 p.m. edited

    If it's not possible to obtain justice, output "RIP".

    LOL