Facebook
From Unreliable Armadillo, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 140
  1. import math
  2. day = int(input())
  3. food = float(input())
  4. cat_food = 0
  5. dog_food = 0
  6. biscuits = 0
  7. total_food = 0
  8. total_day = 0
  9. #Всеки 3 ти ден + бисквитка/храна за деня 10%
  10. # Вашата програма трябва да отпечатва статистика за количеството бисквитки, които са изяли, колко процента
  11. # от първоначалното количество обща храна са изяли и колко процента от изядената храна е изяло кучето и
  12. # колко е изяла котката.
  13. for i in range(day):
  14.     dog = int(input())
  15.  
  16.     cat = int(input())
  17.     total_day += 1
  18.     cat_food += cat
  19.     dog_food += dog
  20.     total_food += cat + dog
  21.     if total_day == 3:
  22.         biscuits = (cat + dog) * 0.1
  23.         total_day = 0
  24. print(f'Total eaten biscuits: {math.ceil(biscuits)}gr.')
  25. print(f'{abs(total_food / food) * 100:.2f}% of the food has been eaten.')
  26. print(f'{(dog_food / total_food ) * 100:.2f}% eaten from the dog.')
  27. print(f'{(cat_food / total_food) * 100:.2f}% eaten from the cat.')