代碼:
import math
a=eval(input())
b=eval(input())
c=eval(input())
p=(a+b+c)/2
s=math.sqrt(p*(p-a)*(p-b)*(p-c))
if a+b>c and a+c>b and b+c>a:
print("YES")
print('{:.2f}'.format(s))
else:
print("NO")
結果:
![](https://img.laitimes.com/img/9ZDMuAjOiMmIsIjOiQnIsIyZuBnLlNWZ4ATYxATMkRGNmhTNiJmY1QTZ3IGZ2YzNhJjNzU2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
代碼:
import math
a=eval(input())
b=eval(input())
c=eval(input())
p=(a+b+c)/2
s=math.sqrt(p*(p-a)*(p-b)*(p-c))
if a+b>c and a+c>b and b+c>a:
print("YES")
print('{:.2f}'.format(s))
else:
print("NO")
結果: