#C6570. Total Daily Calorie Intake
Total Daily Calorie Intake
Total Daily Calorie Intake
You are given a series of meal logs for a day, where each log contains a meal name and its corresponding calorie value. Your task is to calculate the total calorie intake for the day.
Each meal is described by a string (its name) and an integer (the calorie value). Note that the meal name may include spaces, so the calorie value is always the last token in the input line.
The total calorie intake is computed using the following formula:
$$ Total\ Calories = \sum_{i=1}^{n} calories_i $$inputFormat
The first line contains a single integer n
representing the number of meal logs. The following n
lines each contain a meal log. Each meal log is provided as a line with the meal name followed by a space and then an integer indicating the calorie count. Since the meal name may contain spaces, the calorie count is always the last token on the line.
outputFormat
Output a single integer representing the total calorie intake for the day.
## sample4
breakfast 300
lunch 500
snack 150
dinner 600
1550