#P2713. Tire Dimensions
Tire Dimensions
Description
Given the tire descriptor typically found on the sidewall of a passenger or light truck tire, you will calculate the tire's overall circumference. Each line of the sample input contains an example of a tire descriptor. The following diagram illustrates some of the terminology:
The tire descriptor contains the following items of information:
- One or two upper case letters to specify the type of tire. For our purposes, the tire types are "P" (passenger), "LT" (light truck), and "T" (temporary spare tire).
<li>The section width (of an inflated tire) in millimeters. This number is followed by a slash.</li>
<li>The ratio of the section height to the section width, expressed as a percentage. For example, the ratio 75 means that the section height of an inflated tire is 75% of its section width.</li>
<li>Information about the construction of the tire (one upper-case letter), optionally preceded by the speed symbol (also one upper-case letter). In the first, second, and fourth lines of the sample output, the tire construction is specified by "R", which means "radial". In the third line, it is "D", which means "diagonal". In the second line, "R" is preceded by the optional speed symbol "H".</li>
<li>The nominal rim diameter in inches. It is called "nominal" because it does not include the rim's flanges. </li>
The overall circumference (the goal of your calculations) is based on the overall diameter, which is the diameter of an inflated tire at the outermost surface of the tread.
Input
The input will consist of one or more lines, terminated by end-of-file. Each line of the input will contain one tire descriptor, as discussed in the preceding paragraphs. All numerical quantities will be positive integers. Exactly one blank space will separate consecutive items (including the slash) on the input line.
Output
For each line of input, the program will produce exactly one line of output, consisting of: the input line, followed by a colon, one blank space, and the overall circumference, expressed in centimeters, rounded to the nearest integer. Note that 1 centimeter equals 10 millimeters, and 1 inch equals 2.54 centimeters.
P 195 / 75 R 14
P 205 / 60 H R 15
T 115 / 70 D 15
LT 245 / 75 R 16
P 195 / 75 R 14: 204
P 205 / 60 H R 15: 197
T 115 / 70 D 15: 170
LT 245 / 75 R 16: 243
Source
Rocky Mountain 2005