<doocs>0494.Target Sum_1.py
def findTargetSumWays( nums: List[int], target: int) -> int:
    s = sum(nums)
    if s < target or (s - target) % 2 != 0:
        return 0
    n = (s - target) // 2
    dp = [0] * (n + 1)
    dp[0] = 1
    for v in nums:
        for j in range(n, v - 1, -1):
            dp[j] += dp[j - v]
    return dp[-1]
def sample_funcname ( var_0 : List [ int ] , var_3 : int ) -> int :
    var_5 = sum ( var_0 )
    if var_5 < var_3 or ( var_5 - var_3 ) % 2 != 0 :
        return 0
    var_8 = ( var_5 - var_3 ) // 2
    var_10 = [ 0 ] * ( var_8 + 1 )
    var_10 [ 0 ] = 1
    for var_11 in var_0 :
        for var_13 in range ( var_8 , var_11 - 1 , - 1 ) :
            var_10 [ var_13 ] += var_10 [ var_13 - var_11 ]
    return var_10 [ - 1 ]
