Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- days = int(input())
- amount_food = float(input())
- days_num = 0
- num_food_cat = 0
- num_food_dog = 0
- cookie_cat = 0
- cookie_dog = 0
- for c in range(1, days + 1):
- dog = int(input())
- cat = int(input()) # добавяме изядена храна от котката
- days_num += 1 # броим дните в отчета
- if days < days_num: # ако отчетените дни надвишават заложените като срок
- break
- elif days_num % 3 != 0:
- num_food_cat += cat # сумираме изядената храна от котката
- num_food_dog += dog
- if days_num % 3 == 0: # маркираме всеки 3-ти ден
- cookie_cat += cat * 0.1 # заделяме 10% от общата храна за бисквитките
- cookie_dog += dog * 0.1 # math.ceil() закръглено до най–близкото цяло число
- num_food_cat += cat # сумираме изядената храна от котката
- num_food_dog += dog
- print(f"Total eaten biscuits: {round(cookie_cat + cookie_dog)}gr.")
- print(f"{(num_food_cat + num_food_dog) / amount_food * 100:.2f}% of the food has been eaten.")
- print(f"{(num_food_dog) / (num_food_cat + num_food_dog) * 100:.2f}% eaten from the dog.")
- print(f"{(num_food_cat) / (num_food_cat + num_food_dog) * 100:.2f}% eaten from the cat.")
Advertisement
Add Comment
Please, Sign In to add comment