程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> something-Samuel’s NOKIA N73

something-Samuel’s NOKIA N73

編輯:編程解疑
Samuel’s NOKIA N73

Samuel got an NOKIA N73 from his two aunts in the summer of 2007,he is so delighted that he often shows his cellphone off in public. But now he has a problem of his N73,because the appearance of his mobile phone is getting much uglier. As is known to all N73 users,N73′s paint peels off easily. Due to Samuel’s poor protection nearly all the paint on N73 has peeled off. So he made up his mind to do something with his cellphone. Now the cellphone seller gave him two pieces of advise:
1.Sell N73 to buy a new one due to the fact that he has not got enough money.
2.Change the appearance of his N73,but if he changed the value of his cellphone will reduce.
He has to make a decision. However,the right choice that will be made is based on the price he can get if he sells and the changing fee in case he changed N73′s appearance.
Suppose the cellphone he bought at the price of x RMB,and the sell price is fixed at a RMB,if Samuel changes the appearance once the price of cellphone will be reduced by b(0<b<1).So the value of the cellphone after the change is x(1-b)^1.That is too say,if Samuel change for a second time the value is x(1-b)^2. Every time you should compare the left value with the sell price,if the former is higher than the later,Samuel will keep it for another month or he will sell it immediately. And the seller says he will change for Samuel for free.
The question is:
How many times will Samuel change the appearance of his N73 before he decide to sell it at a second hand price?

輸入:

The input consists 2 parts:
the test case’s number t. For each case,the input will contains the original price of N73 x, the money a he will get if he sells,and the reducing rate b. Notice all the numbers here are integers except b.

輸出:

The input consists 2 parts:
the test case’s number t. For each case,the input will contains the original price of N73 x, the money a he will get if he sells,and the reducing rate b. Notice all the numbers here are integers except b.
樣例輸入:

1
3000 2000 0.1
樣例輸出:

Samuel will change the appearance for 3 time(s),before he decide to sell it.

最佳回答:


http://www.acmerblog.com/hdu-2632-samuels-nokia-n73-4219.html

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved