printРабочее место участника

printЗадачи

1057. Auto Loan

Ограничения: время – 2s/4s, память – 32MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

Auto dealerships frequently advertise tempting loan offers in order to make it easier for people to afford the "car of their dreams". A typical sales tactic is to show you various cars, and then talk in terms of what your monthly payment would be, to say nothing of how much you are actually paying for the car, how much interest you pay, or how long you have to make payments.
A typical auto loan is calculated using a fixed interest rate, and is set up so that you make the same monthly payment for a set period of time in order to fully pay off the balance. The balance of your loan starts out as the sticker price of the car. Each month, the monthly interest is added to your balance, and the amount of your payment is subtracted from your balance. (The payment is subtracted after the interest is added.) The monthly interest rate is 1/12 of the yearly interest rate. Thus, if your annual percentage rate is 12%, then 1% of the remaining balance would be charged as interest each month.
You have been checking out some of the cars at your local dealership, TopAuto. An excited salesman has just approached you, shouting about how you can have the car you are looking at for a payment of only monthlyPayment for only loanTerm months! You are to find the annual percentage rate of the loan, assuming that the initial balance of the loan is given.
Notes
  • Because of the way interest is compounded monthly, the actual interest accrued over the course of a year is not necessarily the same as (balance * yearly interest rate). In fact, it's usually more.
  • In a real situation, information like this would typically need to be disclosed, but since you aren't at a point of signing any paperwork, the salesman has no legal obligation to tell you anything.
  • The answer value must be within `10^{-9}` absolute or relative error of the actual result.
Constraints:
  • price will be between 1 and 1000000, inclusive.
  • monthly payment will be between 0 and price / 2, inclusive.
  • loan term will be between 1 and 600, inclusive.
  • the resulting interest rate will be between 0 and 100, inclusive.
First line of input file contains `N` – number of autoloans. Then there are `N` lines, each of these define one situation by three values `A` `B` `C`, separated by spaces. `A` – floating point price of car, `B` – floating point monthly payment, `C` – integer loan term (in months).
For each situation you have to output file one line, contained number of percent to 8 digit after dot.

Sample Input

3
6800 100 68
2000 510 4
15000 364 48

Sample Output

0.00000000
9.56205462
7.68785639
loading