gigafloyd

Задачите от 26.10.2025

Oct 27th, 2025
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.61 KB | Source Code | 0 0
  1. #1
  2.  
  3. for number in range(1, 1000 + 1):
  4.     if number % 10 == 7:
  5.         print(number)
  6.  
  7.  
  8. #2
  9.  
  10. from math import inf
  11.  
  12. count_of_numbers = int(input())
  13. sum_of_all_elements = 0
  14. max_element = -inf
  15. for number in range(count_of_numbers):  # for number in range(1, count_of_numbers + 1)
  16.     current_number = int(input())
  17.     sum_of_all_elements += current_number
  18.     if current_number > max_element:
  19.         max_element = current_number
  20. if max_element == sum_of_all_elements - max_element:
  21.     print("Yes")
  22.     print(f"Sum = {max_element}")
  23. else:
  24.     difference = abs(max_element - (sum_of_all_elements - max_element))
  25.     print("No")
  26.     print(f"Diff = {difference}")
  27.  
  28.  
  29. #3
  30.  
  31. count_of_numbers = int(input())
  32. p1_counter = 0
  33. p2_counter = 0
  34. p3_counter = 0
  35. p4_counter = 0
  36. p5_counter = 0
  37. for number in range(count_of_numbers):
  38.     current_number = int(input())
  39.     if current_number < 200:
  40.         p1_counter += 1
  41.     elif current_number < 400:
  42.         p2_counter += 1
  43.     elif current_number < 600:
  44.         p3_counter += 1
  45.     elif current_number < 800:
  46.         p4_counter += 1
  47.     elif current_number >= 800:  # else
  48.         p5_counter += 1
  49. p1_percentage = p1_counter / count_of_numbers * 100
  50. p2_percentage = p2_counter / count_of_numbers * 100
  51. p3_percentage = p3_counter / count_of_numbers * 100
  52. p4_percentage = p4_counter / count_of_numbers * 100
  53. p5_percentage = p5_counter / count_of_numbers * 100
  54. print(f"{p1_percentage:.2f}%")
  55. print(f"{p2_percentage:.2f}%")
  56. print(f"{p3_percentage:.2f}%")
  57. print(f"{p4_percentage:.2f}%")
  58. print(f"{p5_percentage:.2f}%")
  59.  
  60.  
  61. #4
  62.  
  63. ages = int(input())
  64. laundry_price = float(input())
  65. price_per_toy = int(input())
  66. total_toys = 0
  67. total_money = 0
  68. current_birthday_money = 0
  69. for birthday in range(1, ages + 1):
  70.     if birthday % 2 == 0:  # even birthday
  71.         current_birthday_money += 10
  72.         total_money += current_birthday_money - 1
  73.     else:  # odd birthday
  74.         total_toys += 1
  75. total_money += total_toys * price_per_toy
  76. difference = abs(total_money - laundry_price)
  77. if total_money >= laundry_price:
  78.     print(f"Yes! {difference:.2f}")
  79. else:
  80.     print(f"No! {difference:.2f}")
  81.  
  82.  
  83. #5
  84. opened_tabs = int(input())
  85. salary = float(input())
  86. for current_tab in range(opened_tabs):
  87.     website_name = input()
  88.     if website_name == "Facebook":
  89.         salary -= 150
  90.     elif website_name == "Instagram":
  91.         salary -= 100
  92.     elif website_name == "Reddit":
  93.         salary -= 50
  94.     if salary <= 0:
  95.         break
  96. if salary > 0:
  97.     print(int(salary))
  98. else:
  99.     print("You have lost your salary.")
  100.  
  101.  
  102.  
  103. #7
  104. number_of_groups = int(input())
  105. moussalla_climbers = 0
  106. monblan_climbers = 0
  107. kilimandjaro_climbers = 0
  108. k2_climbers = 0
  109. everest_climbers = 0
  110. for current_group in range(number_of_groups):
  111.     current_group_climbers = int(input())
  112.     if current_group_climbers <= 5:
  113.         moussalla_climbers += current_group_climbers
  114.     elif current_group_climbers <= 12:
  115.         monblan_climbers += current_group_climbers
  116.     elif current_group_climbers <= 25:
  117.         kilimandjaro_climbers += current_group_climbers
  118.     elif current_group_climbers <= 40:
  119.         k2_climbers += current_group_climbers
  120.     elif current_group_climbers >= 41:  # else
  121.         everest_climbers += current_group_climbers
  122. total_climbers = moussalla_climbers + monblan_climbers + kilimandjaro_climbers + k2_climbers + everest_climbers
  123. percentage_moussalla_climbers = moussalla_climbers / total_climbers * 100
  124. percentage_monblan_climbers = monblan_climbers / total_climbers * 100
  125. percentage_kilimandjaro_climbers = kilimandjaro_climbers / total_climbers * 100
  126. percentage_k2_climbers = k2_climbers / total_climbers * 100
  127. percentage_everest_climbers = everest_climbers / total_climbers * 100
  128. print(f"{percentage_moussalla_climbers:.2f}%")
  129. print(f"{percentage_monblan_climbers:.2f}%")
  130. print(f"{percentage_kilimandjaro_climbers:.2f}%")
  131. print(f"{percentage_k2_climbers:.2f}%")
  132. print(f"{percentage_everest_climbers:.2f}%")
  133.  
  134.  
  135.  
  136. #8
  137.  
  138. number_of_tournaments = int(input())
  139. start_points = int(input())
  140. tournaments_won = 0
  141. total_points = 0
  142. for tournament in range(number_of_tournaments):
  143.     standing = input()
  144.     if standing == "W":
  145.         total_points += 2000
  146.         tournaments_won += 1
  147.     elif standing == "F":
  148.         total_points += 1200
  149.     elif standing == "SF":
  150.         total_points += 720
  151. average_points = total_points // number_of_tournaments
  152. total_points += start_points
  153. won_tournaments_percent = tournaments_won / number_of_tournaments * 100
  154. print(f"Final points: {total_points}")
  155. print(f"Average points: {average_points}")
  156. print(f"{won_tournaments_percent:.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment