gigafloyd

Задачите от 15.11.2025

Nov 15th, 2025
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.98 KB | Source Code | 0 0
  1. #1
  2.  
  3. strawberries_price = float(input())
  4. bananas_quantity = float(input())
  5. oranges_quantity = float(input())
  6. raspberries_quantity = float(input())
  7. strawberries_quantity = float(input())
  8. raspberries_price = strawberries_price / 2
  9. oranges_price = raspberries_price * 0.6
  10. bananas_price = raspberries_price * 0.2
  11. needed_money = strawberries_quantity * strawberries_price + \
  12.                raspberries_quantity * raspberries_price + \
  13.                oranges_quantity * oranges_price + \
  14.                bananas_quantity * bananas_price
  15. print(f"{needed_money:.2f}")
  16.  
  17. #2
  18. budget = float(input())
  19. number_of_nights = int(input())
  20. price_per_night = float(input())
  21. additional_expenses_percent = int(input())
  22. needed_money = number_of_nights * price_per_night
  23. if number_of_nights > 7:
  24.     needed_money *= 0.95
  25. budget = budget * (100 - additional_expenses_percent) / 100
  26. difference = abs(budget - needed_money)
  27. if budget >= needed_money:
  28.     print(f"Ivanovi will be left with {difference:.2f} leva after vacation.")
  29. else:
  30.     print(f"{difference:.2f} leva needed.")
  31.  
  32.  
  33.  
  34. #3
  35.  
  36. budget = float(input())
  37. destination = input()
  38. season = input()
  39. number_of_days = int(input())
  40. needed_money = 0
  41. if destination == "Dubai":
  42.     if season == "Winter":
  43.         needed_money = number_of_days * 45000
  44.     elif season == "Summer": #else
  45.         needed_money = number_of_days * 40000
  46.     needed_money *= 0.7
  47. elif destination == "Sofia":
  48.     if season == "Winter":
  49.         needed_money = number_of_days * 17000
  50.     elif season == "Summer":  # else
  51.         needed_money = number_of_days * 12500
  52.     needed_money *= 1.25
  53. elif destination == "London":
  54.     if season == "Winter":
  55.         needed_money = number_of_days * 24000
  56.     elif season == "Summer":  # else
  57.         needed_money = number_of_days * 20250
  58. difference = abs(budget - needed_money)
  59. if budget >= needed_money:
  60.     print(f"The budget for the movie is enough! We have {difference:.2f} leva left!")
  61. else:
  62.     print(f"The director needs {difference:.2f} leva more!")
  63.  
  64. #4
  65.  
  66. number_of_days = int(input())
  67. total_food = float(input())
  68. total_eaten_biscuits = 0
  69. total_dog_eaten_food = 0
  70. total_cat_eaten_food = 0
  71. for current_day in range(1, number_of_days + 1):
  72.     dog_eaten_food = int(input())
  73.     cat_eaten_food = int(input())
  74.     total_dog_eaten_food += dog_eaten_food
  75.     total_cat_eaten_food += cat_eaten_food
  76.     current_day_total_eaten_food =dog_eaten_food + cat_eaten_food
  77.     if current_day % 3 == 0:
  78.         total_eaten_biscuits += current_day_total_eaten_food * 0.1
  79. total_eaten_food = total_dog_eaten_food + total_cat_eaten_food
  80. percent_eaten_food = total_eaten_food / total_food * 100
  81. percent_eaten_by_dog = total_dog_eaten_food / total_eaten_food * 100
  82. percent_eaten_by_cat = total_cat_eaten_food / total_eaten_food * 100
  83. print(f"Total eaten biscuits: {round(total_eaten_biscuits)}gr.")
  84. print(f"{percent_eaten_food:.2f}% of the food has been eaten.")
  85. print(f"{percent_eaten_by_dog:.2f}% eaten from the dog.")
  86. print(f"{percent_eaten_by_cat:.2f}% eaten from the cat.")
  87.  
  88.  
  89.  
  90. #5
  91.  
  92. first_player_eggs = int(input())
  93. second_player_eggs = int(input())
  94. someone_won = False
  95. someone_won_message = ""
  96. command = input()
  97. while command != "End":
  98.     if command == "one":
  99.         second_player_eggs -= 1
  100.     elif command == "two":
  101.         first_player_eggs -= 1
  102.     if first_player_eggs == 0:
  103.         someone_won = True
  104.         someone_won_message = f"Player one is out of eggs. Player two has {second_player_eggs} eggs left."
  105.     elif second_player_eggs == 0:
  106.         someone_won = True
  107.         someone_won_message = f"Player two is out of eggs. Player one has {first_player_eggs} eggs left."
  108.     if someone_won: # if someone_won == True
  109.         break
  110.     command = input()
  111. if someone_won:
  112.     print(someone_won_message)
  113. else:
  114.     print(f"Player one has {first_player_eggs} eggs left.")
  115.     print(f"Player two has {second_player_eggs} eggs left.")
  116.  
  117.  
  118.  
  119. #6
  120.  
  121. first_number = input()
  122. second_number = input()
  123. first_number_first_digit = first_number[0]
  124. first_number_second_digit = first_number[1]
  125. first_number_third_digit = first_number[2]
  126. first_number_fourth_digit = first_number[3]
  127. second_number_first_digit = second_number[0]
  128. second_number_second_digit = second_number[1]
  129. second_number_third_digit = second_number[2]
  130. second_number_fourth_digit = second_number[3]
  131. for first_digit in range(int(first_number_first_digit), int(second_number_first_digit) + 1):
  132.     for second_digit in range(int(first_number_second_digit), int(second_number_second_digit) + 1):
  133.         for third_digit in range(int(first_number_third_digit), int(second_number_third_digit) + 1):
  134.             for fourth_digit in range(int(first_number_fourth_digit), int(second_number_fourth_digit) + 1):
  135.                 if first_digit % 2 != 0 and \
  136.                         second_digit % 2 != 0 and \
  137.                         third_digit % 2 != 0 and \
  138.                         fourth_digit % 2 != 0:
  139.                     print(f"{first_digit}{second_digit}{third_digit}{fourth_digit}", end=" ")
  140.  
  141.  
  142.  
Add Comment
Please, Sign In to add comment