of in the cold food of out hot eat the food

시간 제한1초메모리 제한2048 MB

요약
원하는 온도에서 조리 시간 T와 예열 시간 H가 주어질 때, 음식을 바로 넣었을 때 다 익는 데 걸리는 총 시간을 구한다.
난이도

보통10점 중 4점

유형
수학, 이분 탐색, 시뮬레이션
정답자
아직 제출이 없습니다

문제

Many recipes call for preheating an oven followed by putting food in the oven once the oven reaches the desired temperature. Thomas considers this process remarkably inefficient since energy is expended while preheating without cooking the food. To be more energy-efficient, he decides to put the food in the oven right when he turns it on.

Thomas’s food requires TT minutes of cooking at the oven’s desired temperature. The amount of energy transferred to the food by the oven in a certain amount of time is linearly correlated with its temperature. When the oven is off, no energy is transferred to the food, and it would take forever to finish cooking. If the oven was set to a temperature that is halfway to the desired temperature, the food would need 2T2T minutes to finish cooking. Thomas knows that his oven will take HH minutes to reach the desired temperature, with the temperature increasing linearly over time. For example, after H2\frac{H}{2} minutes, the oven will be halfway to the desired temperature.

Your task is to determine how long it will take for Thomas’s food to be fully cooked when he puts the food in immediately, rather than preheating the oven first.

입력

The first line contains two integers TT and HH (1≤T,H≤1091≤T,H≤10^9) as described above.

출력

Output a single floating-point number representing the total time in minutes required for Thomas’s food to cook. Your answer will be considered correct if it has an absolute or relative error of at most 10−310^{-3}.

예제3

  1. 예제 1

    입력
    10 1
    
    예상 출력
    10.5000000000
    
  2. 예제 2

    입력
    1 10
    
    예상 출력
    4.4721359550
    
  3. 예제 3

    입력
    10 10
    
    예상 출력
    15.0000000000