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

8272번 - Unlucky 스페셜 저지다국어

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

문제

Quite unluckily Byteasar has found himself in the middle of a desert, s meters from the closest oasis.

Lucky enough, Byteasar has a compass and he perfectly knows in which direction he should go to reach the oasis. He has w milliliters of water with him, but he is able to carry at most k milliliters at a time. Walking one meter requires drinking one milliliter of water for Byteasar; for simplicity we assume that Byteasar drinks water at a fixed pace, e.g. after walking 1 / 3 meters he has drunk 1 / 3 milliliters of water. At each moment of time Byteasar can put aside any amount of water that he can drink later. Sometimes it may pay him off to come back for water that he has left behind.

To prevent further unlucky coincidence, Byteasar would like to bring as much water to the oasis as possible (who knows if there is any water in that oasis, anyway?). How much water is he able to bring?

We assume that Byteasar is able to reach the oasis if he chooses a smart enough water-drinking strategy.

입력

The first line of the standard input contains three integers s, w and k (10 ≤ s, w, k ≤ 100 000 000) that represent Byteasar's distance from the oasis, the quantity of water that he has and the maximum quantity of water that he can carry.

출력

Your program should write to the standard output one real number: the maximum volume of water (in milliliters) that Byteasar can bring to the oasis. The number should be written with three digits after the dot. Your solution will be accepted if it differs from the exact result by at most 10-3.

제한

예제 입력 1

10 30 10

예제 출력 1

5.333

힌트

출처

Contest > Algorithmic Engagements > PA 2011 2-1번

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

출처

대학교 대회

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

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