-->
当前位置:首页 > 题库

PROGRAMMING:Weighted sum of list number elements (2)

Luz5年前 (2021-05-10)题库437
Enter a nested list with unlimited nesting levels, and calculate the weighted sum of list elements according to the levels. Each element of the first layer
The value of is: element value \ * 1, the value of each element in the second layer is: element value \ * (- 2), and the value of each element in the third layer is: element value \ * 3,
The value of each element in the fourth layer is: element value \ * (- 4),..., and so on!
###Input format:
Enter the list on one line
###Output format:
Output the weighted sum on one line
###Input example:
Here is a set of inputs. For example:
```in
[1,2,[3,4,[5,6],7],8]
```
###Output example:
The corresponding output is given here. For example:
```out
sixteen
```







answer:If there is no answer, please comment