Advertisement
marev81

Training Lab - First Steps in Coding - More Exercises

Jun 26th, 2023 (edited)
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.70 KB | None | 0 0
  1. https://judge.softuni.org/Contests/Practice/Index/1642#4
  2.  
  3. # 1
  4. width_hall_in_meters = float(input()) * 100      # rows
  5. height_hall_in_meters = float(input()) * 100        # columns
  6.  
  7. num_of_rows = (width_hall_in_meters - 100) // 120
  8. num_of_columns = height_hall_in_meters // 70
  9. workplaces = num_of_columns * num_of_rows - 3
  10. print(int(workplaces))
  11.  
  12. #2
  13. width_hall_in_meters = float(input())
  14. height_hall_in_meters = float(input())
  15.  
  16. width_hall_in_cm = width_hall_in_meters * 100
  17. height_hall_in_cm = height_hall_in_meters * 100
  18.  
  19. num_of_rows = (width_hall_in_cm - 100) // 120
  20. num_of_columns = height_hall_in_cm // 70
  21. workplaces = num_of_columns * num_of_rows - 3
  22. print(int(workplaces))
  23.  
  24. #3
  25. import math
  26.  
  27. width_hall_in_meters = float(input())
  28. height_hall_in_meters = float(input())
  29.  
  30. width_hall_in_cm = width_hall_in_meters * 100
  31. height_hall_in_cm = height_hall_in_meters * 100
  32.  
  33. num_of_rows = math.floor((width_hall_in_cm - 100) / 120)
  34. num_of_columns = math.floor(height_hall_in_cm / 70)
  35. workplaces = num_of_columns * num_of_rows - 3
  36. print(workplaces)
  37.  
  38. #4
  39. width_hall_in_cm = float(input()) * 100
  40. height_hall_in_cm = float(input()) * 100
  41.  
  42. num_of_rows = (width_hall_in_cm - 100) // 120
  43. num_of_columns = height_hall_in_cm // 70
  44. workplaces = num_of_columns * num_of_rows - 3
  45.  
  46. print(workplaces)
  47.  
  48. #5
  49. width_hall_in_m = float(input())
  50. height_hall_in_m = float(input())
  51.  
  52. width_hall_in_cm = width_hall_in_m * 100
  53. height_hall_in_cm = height_hall_in_m * 100
  54.  
  55. place_width = 120
  56. place_height = 70
  57. corridor = 100
  58.  
  59. num_of_rows = int((width_hall_in_cm - corridor) / place_width)
  60. num_of_columns = int(height_hall_in_cm / place_height)
  61. workplaces = (num_of_columns * num_of_rows) - 3
  62.  
  63. print(workplaces)
  64.  
Tags: softuni
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement