Advertisement
SimeonTs

SUPyF2 P.-Mid-Exam/30 June 2019/2. - Giftbox Coverage

Oct 28th, 2019
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.27 KB | None | 0 0
  1. """
  2. Programming Fundamentals Mid Exam - 30 June 2019 Group 2
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1683#0
  4.  
  5. SUPyF2 P.-Mid-Exam/30 June 2019/2. - Giftbox Coverage
  6.  
  7. Problem:
  8. Create a program that calculates what percentage you can cover of a 6-sided gift box (all sides are equal and square).
  9. First, you will receive the size of a side. Also, you will receive the sheets of paper you have.
  10. Last, you will receive how much area covers a single sheet of paper.
  11. First, you need to calculate the area of the gift box.
  12. Then you have to calculate how much area you can cover with the paper available.
  13. Keep in mind that every third sheet covers only 25% of the usual area.
  14. You have to calculate what percentage of the gift box you’ve covered. Percentage can exceed 100%!
  15. In the end, print the percentage of the area covered, formatted to the 2nd decimal place, in the following format:
  16. "You can cover {percentage}% of the box."
  17. Input
  18. • On the 1st line you will receive the size of a side – a real number in the range [0.0…50.0]
  19. • On the 2rd line you will receive the number of sheets of paper – an integer number in the range [0…1000]
  20. • On the 3th line you will receive the area a single sheet of paper covers – a real number in the range[0.0…50.0]
  21. • The input will always be in the right format.
  22. Output
  23. • In the end print the percentage of the area covered formatted to the
  24.    2nd decimal place in the format described above.
  25. Constraints
  26. • Percentage can be over 100%.
  27. • All numbers are centimeters.
  28.  
  29. Examples:
  30. Input:
  31. 5
  32. 30
  33. 4
  34.  
  35. Output:
  36. You can cover 60.00% of the box.
  37.  
  38. Comments:
  39. The size of a side is 5. We have 6 sides, so the area is 5 * 5 * 6 = 150.
  40. 20 of sheets will cover 4 centimeters and 10 – 1 cm. The total area covered is 90, which is 60% of the total area.
  41.  
  42. Input:
  43. 2.5
  44. 32
  45. 4.25
  46.  
  47. Output:
  48. You can cover 277.67% of the box.
  49. """
  50. import math
  51. size_of_a_side = float(input())
  52. sheets_of_paper = int(input())
  53. area_single_sheet = float(input())
  54.  
  55. total_area = size_of_a_side * size_of_a_side * 6
  56. third_sheets = math.floor(sheets_of_paper / 3)
  57. sheets_area = (sheets_of_paper - (third_sheets * 0.75)) * area_single_sheet
  58. percentage = sheets_area * 100 / total_area
  59.  
  60. print(f"You can cover {percentage:.2f}% of the box.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement