Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- days = int(input())
- kilometers = float(input())
- total_kilometers = kilometers
- for i in range(days):
- percentage = float(input())
- kilometers *= (100 + percentage) / 100
- total_kilometers += kilometers
- if total_kilometers < 1000:
- print(f"Sorry Mrs. Ivanova, you need to run {1000 - math.floor(total_kilometers)} more kilometers")
- else:
- print(f"You've done a great job running {math.ceil(total_kilometers) - 1000} more kilometers!")
- ИЛИ:
- days = int(input())
- kilometers = float(input())
- total_kilometers = 1000 - kilometers
- for i in range(days):
- kilometers *= (100 + float(input())) / 100
- total_kilometers -= kilometers
- if total_kilometers > 0:
- print(f"Sorry Mrs. Ivanova, you need to run {int(total_kilometers + 0.99)} more kilometers")
- else:
- print(f"You've done a great job running {int(abs(total_kilometers) + 0.99)} more kilometers!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement