#K1466. Temperature Adjustment Problem

    ID: 24184 Type: Default 1000ms 256MiB

Temperature Adjustment Problem

Temperature Adjustment Problem

You are given a task to adjust the temperature from its current value to a desired value. The adjustment is performed in discrete steps, and in each step the temperature changes by at most a fixed adjustment rate. Each adjustment incurs an energy cost. Using the formula below, compute the total time (number of adjustment steps) and the total energy cost required to achieve the desired temperature.

The number of adjustments is computed as follows:

\(\text{adjustments} = \left\lceil \frac{|\text{desired\_temp} - \text{current\_temp}|}{\text{adjustment\_rate}} \right\rceil\)

The total energy cost is then:

\(\text{total\_energy} = \text{adjustments} \times \text{adjustment\_cost}\)

If the current temperature is already equal to the desired temperature, no adjustments are needed.

inputFormat

The input consists of 4 space-separated integers in one line:

  • current_temp: the current temperature.
  • desired_temp: the target temperature.
  • adjustment_rate: the maximum temperature change per adjustment step.
  • adjustment_cost: the energy cost of each adjustment step.

outputFormat

Output two space-separated integers: the total number of adjustments (i.e., time) and the total energy cost required to reach the desired temperature.

## sample
20 25 2 5
3 15