【每日一题20220217】生日礼物

:woman_mage: 赫敏的生日快到了,哈利准备送给她一份礼物,并且将它打包再一个礼盒中,并且扎上丝带进行装饰。但是具体需要多长的丝带呢?

礼盒的长、宽、高分别用length, width 和 height 三个参数来表示,单位是厘米cm。并且丝带必须绕过礼盒的两个最大面,最后还需预留20cm长度用来打结。

打包示意图:
image

请编写一个函数,接收长/宽/高数值,计算出总共需要的丝带长度。

示例:
输入:(17,32,11) ,输出:162
输入: (13,13,13),输出: 124

题目难度:简单
题目来源:CodeWars: Happy Birthday

def solution(int length, int width, int height) -> int:
    # your code here

assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32 
return 4 * height + 2 * (length + width)+20

def solution3(length: int, width: int, height: int) → int:
num = length * 2 + width * 2 + height * 4 +20
return num

assert solution3(17, 32, 11) == 162
assert solution3(13, 13, 13) == 124
assert solution3(1, 3, 1) == 32

def solution(length: int, width: int, height: int) -> int:
    return length * 2 + width * 2 + height * 4 + 20


assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32
def solution(length: int, width: int, height: int) -> int:
    return length * 2 + width * 2 + height * 4 + 20


assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32
def solution(length: int, width: int, height: int) -> int:
    return length * 2 + width * 2 + height * 4 + 20


assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32
def solution(length, width, height):
    return min([length,width,height]) * 2 + sum([length,width,height]) * 2 + 20
def solution(length: int, width: int, height: int) -> int:
    return length * 2 + width * 2 + height * 4 + 20

def solution(length:int,width:int,height:int) -> int:
    return 4*height+2*(width+length)+20


print(solution(13, 13, 13))
assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32
    def solution(length:int,width:int,height:int) -> int:
        return (length+width+height+height+10) * 2
    assert solution(17, 32, 11) == 162
    assert solution(13, 13, 13) == 124
    assert solution(1, 3, 1) == 32
def solution(length: int, width: int, height: int) -> int:
    return 20 + 4 * height + 2 * length + 2 * width


assert solution(17, 32, 11) == 162
assert solution(13, 13, 13) == 124
assert solution(1, 3, 1) == 32