SHARE
TWEET

pycharmprog

Marion_Perchik Dec 9th, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2. from typing import List
  3.  
  4.  
  5. def parse_input_token(string, token) -> List[float]:
  6.     result = string.split(token)
  7.     if len(result) == 2:
  8.         result = [float(v) for v in result]
  9.         result.sort()
  10.         return result
  11.     return []
  12. def parse_input(string):
  13.     for token in ["x", "*", " "]:
  14.         v = parse_input_token(string, token)
  15.         if v: return v
  16.     return None
  17. def main():
  18.     roll_width, roll_length = parse_input(input())
  19.     roll_sq = roll_width * roll_length
  20.     total_wall_sq = 0
  21.     while True:
  22.         value = input()
  23.         if value == "стоп":
  24.             break
  25.         wall_width, wall_length = parse_input(value)
  26.         total_wall_sq += wall_width * wall_length
  27.     print(f"Площадь обрабатываемой поверхности: {total_wall_sq}")
  28.     roll_amount = math.ceil(total_wall_sq / roll_sq)
  29.     total_roll_sq = roll_amount * roll_sq
  30.     print(f"Общая площадь закупаемого материала: {total_roll_sq}")
  31.     print(f"Количество рулонов закупаемого материала: {roll_amount}")
  32.     over_sq_percent = 100 * ((total_roll_sq - total_wall_sq) / total_wall_sq)
  33.     print(f"Излишек материалов: {over_sq_percent}%")
  34. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top