Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int n, dayMinutes, totalMinutes = 0, totalCalories = 0;
- double dayDistance, totalDistance = 0;
- string distanceUnit;
- cin >> n;
- for (int i = 0; i < n; i++) {
- cin >> dayMinutes;
- cin >> dayDistance;
- cin >> distanceUnit;
- if (distanceUnit == "m")
- dayDistance *= 0.001;
- totalMinutes += dayMinutes;
- totalDistance += dayDistance;
- totalCalories += dayMinutes * 400 / 20;
- }
- printf("He ran %.2fkm for %i minutes and burned %i calories.", totalDistance, totalMinutes, totalCalories);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement