Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int days;
- cin >> days;
- double kilometers, percentage;
- cin >> kilometers;
- double totalKilometers = kilometers;
- for (int i = 0; i < days; i++) {
- cin >> percentage;
- kilometers *= (100.0 + percentage) / 100;
- totalKilometers += kilometers;
- }
- if (totalKilometers < 1000) {
- cout << "Sorry Mrs.Ivanova, you need to run " << 1000 - floor(totalKilometers) << " more kilometers\n";
- }
- else{
- cout << "You've done a great job running " << ceil(totalKilometers) - 1000 << " more kilometers!\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement