#C1495. Total CO2 Emissions Calculation
Total CO2 Emissions Calculation
Total CO2 Emissions Calculation
You are given a list of trips taken in a town. Each trip is described by a mode of transport and the distance traveled in kilometers. The mode is represented by a single character: B
for bicycle and C
for car. Only car trips produce CO2 emissions. In fact, each car trip produces $$2.3 \times d$$ kilograms of CO2 for d kilometers. Your task is to compute the total CO2 emissions for all the trips provided, rounding the final result to two decimal places.
Note: Bicycle trips do not contribute to the emissions.
inputFormat
The input is given via standard input (stdin) and has the following format:
- The first line contains an integer n — the number of trips.
- The following n lines each contain a trip description. Each description consists of a character (
B
orC
) followed by an integer representing the number of kilometers traveled. The two values are separated by a space.
For example:
3 B 10 C 50 C 20
outputFormat
The output should be printed to standard output (stdout) and is a single line containing the total CO2 emissions in kilograms, rounded to two decimal places.
For the sample input provided, the correct output is:
161.00## sample
3
B 10
B 20
B 30
0.00