Advertisement
Korotkodul

gaz_N3

Jan 13th, 2023 (edited)
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. def f(a, b): #a, b - кол-во кубометров, к-рые продаём
  2.     return 16 * a + 33 * b
  3.  
  4. def var1(a, b):
  5.     nat = min(a, 2200)
  6.     liq = min(b, 3500)
  7.     return f(nat, liq)
  8.  
  9. def var2(a, b):
  10.     nat = min(a, 3800)
  11.     liq = min(b, 2450)
  12.     return f(nat, liq)
  13.  
  14. def worse(a, b):
  15.     v1 = var1(a, b)
  16.     v2 = var2(a, b)
  17.     return min(v1, v2)
  18.  
  19. var = [
  20.     [4032, 2970],
  21.     [3032, 2954],
  22.     [578, 1970],
  23.     [3132, 2854]
  24.     ]
  25.  
  26. res = []
  27.  
  28. for a in var:
  29.     now = (f(a[0], a[1]), a)
  30.     res.append(now)
  31. print(res)
  32.  
  33. res = sorted(res)
  34. res = res[::-1]
  35. print(res)
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement