Logo
(追記) (追記ここまで)

9307번 - Geometric Inflation 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB247534322.513%

문제

A very unusual model of inflation can be simulated by multiplying the cost of a given item 3 months ago with the cost of the item 2 months ago and dividing that quantity by the cost of the item 1 month ago. The costs will be given in dollars, with no more than 2 decimal places representing cents. No cost can include partial cents, so always round to the nearest whole cent for every month.

For example, suppose dumplings from the corner cost \5ドル.23 in month 1, \5ドル.50 in month 2, and \5ドル.52 in month 3. It is now month 4 and we need to find out how much to charge considering inflation. We would multiply 5.23 by 5.50 to get 28.765. Note: no rounding takes place at this step. Then take that quantity and divide it by 5.52 to get 5.21.

입력

Each line will start with 3 decimal numbers, with 1 or 2 decimal places, representing the costs at month 1, 2, and 3. The next input on the line will be an integer, N, between 1 and 100 inclusively indicating for which month the cost is to be calculated. A line starting with -1 will mark the end of the test cases.

출력

For each test case (line of input) you should calculate the cost for that month and output your result as “Month N cost: \$c”, where c is the cost in dollars. Each output should have exactly 2 decimal digits and be comma grouped. The cost for every month that you are requested to find will fit in a Java double.

제한

예제 입력 1

5.23 5.5 5.52 4
5.23 5.5 5.52 2
-1

예제 출력 1

Month 4 cost: 5ドル.21
Month 2 cost: 5ドル.50

힌트

출처

School > University of Virginia High School Programming Contest > UVa HSPC 2011 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /