#K9546. Calculate Calories Burned
Calculate Calories Burned
Calculate Calories Burned
You are given a list of physical activities. Each activity is described by its type, duration (in minutes), and intensity. Using the data provided, compute the total calories burned.
For each activity, the calories burned is calculated using the formula:
Where the rate depends on the activity type and intensity as follows:
- Walking: low: 3, medium: 4.5, high: 6
- Running: low: 8, medium: 11, high: 14
- Cycling: low: 5, medium: 7.5, high: 10
If the input list is empty, the output should be 0. Note that all multiplications use the formula above and results should be printed as an integer if the total is a whole number.
inputFormat
The input is given via standard input (stdin) and has the following format:
N activity_1 duration_1 intensity_1 activity_2 duration_2 intensity_2 ... activity_N duration_N intensity_N
Where:
N
is a non-negative integer representing the number of activities.- Each of the next N lines contains an activity description with three values separated by spaces:
activity
: a string which can be "walking", "running", or "cycling".duration
: an integer representing the duration in minutes.intensity
: a string that can be "low", "medium", or "high".
outputFormat
Output the total calories burned calculated based on the given activities. The result should be printed to standard output (stdout) as a single number. If the output is a whole number, it should be printed as an integer.
## sample3
walking 30 medium
running 20 high
cycling 60 low
715