回答編集履歴
2
修正
test
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
`numpy`を使うと簡単
|
2
|
+
|
3
|
+
```
|
4
|
+
|
5
|
+
pip install numpy==1.19.3
|
6
|
+
|
7
|
+
```
|
2
8
|
|
3
9
|
```Python
|
4
10
|
|
1
修正
test
CHANGED
@@ -10,9 +10,9 @@
|
|
10
10
|
|
11
11
|
arr = np.array(lst)
|
12
12
|
|
13
|
-
arr = arr[arr != 0]
|
13
|
+
arr = arr[arr != 0] # 0を排除
|
14
14
|
|
15
|
-
val = int(np.prod(arr))
|
15
|
+
val = int(np.prod(arr)) # 総積を求める(空なら1)
|
16
16
|
|
17
17
|
return val
|
18
18
|
|