4079 - Helping ACM Program

Created by Yonny Mondelo Hernández
Added by ymondelo20 (2018-09-05)
Limits
Total Time: 25000 MS | Test Time: 1000 MS |Memory: 512 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

A new automated system has been installed in a car tire factory, as part of the goal of streamlining enterprise profits. This and others ideas are results of the continuous work by an organization called the Innovative Code and Programming Competitions (ICPC).

Each day the system will be configured to produce several car tires, all them with a circular shape and an initial radius R (measured in centimeters). Later, knowing the final radius needed for each tire, a machine in another part of the factory will stably reduce each wheel to its final desired radius.

The machine works at constant speed, reducing the tire's radius by S centimeters each minute. Starting with a radius R, the radius will be R-S after the first minute, then R-2×S after the second minute, and so on (so that after minute T the radius will be R-T×S).

The Association for Circular Measurements (ACM) is responsible for calculating the time needed for reducing each tire radius. As one of their best engineers, you have been selected to create a program to help on that task.

So, given the value of R for some particular day, and the final desired radius of each car tire (not necessarily equal), you need to find the total time in minutes needed to complete the task of producing all of the tires. The machine works on at most one tire at a time, and exactly one minute is needed to remove a tire from the machine or place a new one in it. The machine must start and finish each day completely empty (no tires in it).
Se ha instalado un nuevo sistema automatizado en una fábrica de neumáticos para automóviles, como parte del objetivo de racionalizar las ganancias empresariales. Esta y otras ideas son el resultado del trabajo continuo de la organización Innovadores de Código para la Programación Competitiva (ICPC).

Cada día, el sistema se configura para producir varios neumáticos de automóvil, todos ellos con una forma circular y un radio inicial R (medido en centímetros). Más tarde, sabiendo el radio final necesario para cada neumático, una máquina en otra parte de la fábrica reducirá de manera estable cada rueda a su radio final deseado.

La máquina funciona a velocidad constante, reduciendo el radio del neumático en S centímetros por minuto. Comenzando con un radio R, el radio será R-S después del primer minuto, luego R-2×S después del segundo minuto, y así sucesivamente (de modo que después del minuto T el radio será R-T×S).

La Asociación para el Chequeo de Medidas (ACM) es responsable de calcular el tiempo necesario para reducir el radio de cada neumático. Como uno de sus mejores ingenieros, has sido seleccionado para crear un programa que ayude en esa tarea.

Por lo tanto, dado el valor de R para un día en particular y el radio final deseado de cada neumático de automóvil (no necesariamente igual), debes encontrar el tiempo total en minutos necesario para completar la tarea de producir todos los neumáticos. La máquina funciona como máximo con un neumático a la vez, y se necesita exactamente un minuto para retirar un neumático de la máquina o colocar uno nuevo. La máquina debe comenzar y terminar cada día completamente vacía (sin neumáticos).
A new automated system has been installed in a car tire factory, as part of the goal of streamlining enterprise profits. This and others ideas are results of the continuous work by an organization called the Innovative Code and Programming Competitions (ICPC).

Each day the system will be configured to produce several car tires, all them with a circular shape and an initial radius R (measured in centimeters). Later, knowing the final radius needed for each tire, a machine in another part of the factory will stably reduce each wheel to its final desired radius.

The machine works at constant speed, reducing the tire's radius by S centimeters each minute. Starting with a radius R, the radius will be R-S after the first minute, then R-2×S after the second minute, and so on (so that after minute T the radius will be R-T×S).

The Association for Circular Measurements (ACM) is responsible for calculating the time needed for reducing each tire radius. As one of their best engineers, you have been selected to create a program to help on that task.

So, given the value of R for some particular day, and the final desired radius of each car tire (not necessarily equal), you need to find the total time in minutes needed to complete the task of producing all of the tires. The machine works on at most one tire at a time, and exactly one minute is needed to remove a tire from the machine or place a new one in it. The machine must start and finish each day completely empty (no tires in it).

Input specification

The first line will contain two space-separated real numbers R (5 R 103) and S (1 S 100), representing the initial radius of all wheels and the reduction value of the machine per minute, both measured in centimeters. The second line will contain an integer number N (1 N 105), representing the number of wheel needed. And the following N lines will contain a real number F (0 < F R) representing the final desired radius of each car wheel for that day. All real values will be given with exactly one decimal place.
La primera línea contendrá dos números reales R (5 ≤ R ≤ 10^3) y S (1 ≤ S ≤ 100), separados por un espacio, que representan el radio inicial de todas los neumáticos y el valor de reducción de la máquina por minuto, ambos medidos en centímetros . La segunda línea contendrá un número entero N (1 ≤ N ≤ 10^5), que representa el número de neumáticos necesarios. Y las siguientes N líneas contendrán un número real F (0 < F ≤ R) que representa el radio final deseado de cada rueda de automóvil para ese día. Todos los valores reales se darán con exactamente una cifra decimal.
The first line will contain two space-separated real numbers R (5 R 103) and S (1 S 100), representing the initial radius of all wheels and the reduction value of the machine per minute, both measured in centimeters. The second line will contain an integer number N (1 N 105), representing the number of wheel needed. And the following N lines will contain a real number F (0 < F R) representing the final desired radius of each car wheel for that day. All real values will be given with exactly one decimal place.

Output specification

You must output a line with a real number, representing the total time in minutes needed to achieve the task. Your answer will be considered correct if its absolute error doesn't exceed 10-4. Formally, if your answer is a and the judge’s answer is b, the checker will accept your answer if |a - b| ≤ 10-4.
;jsessionid=383F940878A25A69A498F2AD02874984
Debe generar una línea con un número real, que represente el tiempo total en minutos necesarios para lograr la tarea. Su respuesta se considerará correcta si su error absoluto no supera 10-4. Formalmente, si su respuesta es a y la respuesta del juez es b, el verificador aceptará su respuesta si |a - b| ≤ 10-4.
The first line will contain two space-separated real numbers R (5 R 103) and S (1 S 100), representing the initial radius of all wheels and the reduction value of the machine per minute, both measured in centimeters. The second line will contain an integer number N (1 N 105), representing the number of wheel needed. And the following N lines will contain a real number F (0 < F R) representing the final desired radius of each car wheel for that day. All real values will be given with exactly one decimal place.

Sample input

8.5 3.2
7
1.6
0.5
3.6
8.3
1.1
5.0
6.6

Sample output

24.25

Hint(s)