题解 | 计算三角形的周长和面积

计算三角形的周长和面积

https://www.nowcoder.com/practice/109a44d649a142d483314e8a57e2c710

from math import sqrt
lines = input()
a, b, c = map(int, lines.split())

def compute(a, b, c):
    circumferences = a + b + c
    # 海伦公式
    s = circumferences / 2
    areas = sqrt(s * (s - a) * (s - b) * (s - c))

    return circumferences, areas

circumference, area = compute(a, b, c)

print(f"{circumference=:.2f} {area=:.2f}")

全部评论

相关推荐

点赞 评论 收藏
分享
LZHR:老哥你从投递简历测评完到一面中间隔了多久呀,我这边已经过了五天了仍显示简历筛选中是不是就是挂了
腾讯求职进展汇总
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务