eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

Credit Card Payment

Credit Card Payment

\includegraphics{https://static.e-olymp.com/content/ac/ac5985655a29a87fc5a3b97e7ab4615c68129ce4.jpg} Using credit cards for your purchases is convenient, but they have high interest rates if you do not pay your balance in full each month. The interest rate is commonly quoted in terms of "annual percentage rate" (APR) which is then applied to the outstanding balance each month. The APR can be converted to a monthly interest rate \textbf{R}. At the end of each month, the monthly interest rate is applied to the outstanding balance and the interest is added to the total balance. Any payment made will be applied to the balance in the following month. The monthly interest is rounded to the nearest cent (rounding up \textbf{0.5} cent and above) in the calculations. You have unfortunately accumulated an outstanding balance \textbf{B} at the end of the month and you can only afford to pay up to some amount \textbf{M} every month. If you do not make any more purchases with the credit card, what is the minimum number of payments needed to completely eliminate the outstanding balance? It is possible that you cannot pay off the balance in \textbf{100} years (\textbf{1200} payments). \InputFile The input consists of multiple test cases. The first line of input is a single integer, not more than \textbf{1000}, indicating the number of test cases to follow. Each of the following lines specify the input for one case. Each line contains three positive real numbers separated by single spaces: \textbf{R}, \textbf{B}, and \textbf{M}. The real numbers have two digits after the decimal point, satisfying \textbf{R} ≤ \textbf{50.00} and \textbf{B}, \textbf{M} ≤ \textbf{50000.00}. \textbf{R} is the monthly interest rate and is specified as a percentage. \OutputFile For each case, display on a line the minimum number of payments needed to eliminate the outstanding balance. If this cannot be done in at most \textbf{1200} payments, print instead \textbf{impossible}.
Лимит времени 2 секунды
Лимит использования памяти 64 MiB
Входные данные #1
11
2.00 100.00 105.00
2.00 100.00 102.00
2.00 100.00 100.00
2.00 100.00 4.00
2.00 100.00 3.00
2.00 100.00 1.00
2.00 100.00 2.00
9.56 5462.50 522.22
12.50 29876.44 33610.99
5.50 1.00 1.05
14.78 40181.09 46119.86
Выходные данные #1
1
1
2
36
56
impossible
impossible
impossible
2
2
1
Источник 2013 Rocky Mountain Regional ACM Contest