Advertisement
dream_4ild

9-И-2 ex.1

Dec 10th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Nov 19 20:09:32 2020
  4.  
  5. @author: Sergey
  6. """
  7.  
  8. import math
  9.  
  10. def check(a,b,c):
  11.     if (a + b >= c) and (a+c>=b) and (b+c>=a):
  12.         return True
  13.     else:
  14.         return False
  15.  
  16. def sq(a,b,c):
  17.     p=(a+b+c)/2
  18.     S = math.sqrt(p*(p-a)*(p-b)*(p-c))
  19.     return S
  20.  
  21. a,b,c,d=float(input()),float(input()),float(input()),float(input())
  22. data=[a,b,c,d]
  23. ans=-1
  24. for i in range(4):
  25.     for j in range(i+1,4):
  26.         for k in range(j+1,4):
  27.             if check(data[i],data[j],data[k]):
  28.                 ans = max(ans,sq(data[i],data[j],data[k]))
  29. if ans == -1:
  30.     print('Таких треугольников нет')
  31. else:
  32.     print(ans)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement