📌
高速な掛け算を上手く利用する
概要
https://atcoder.jp/contests/abc169/editorial/7188 の「高速な掛け算を上手く利用する」を実装してみました。
実装
arr = [1, 2, 3, 4]
@show arr
while length(arr) ≠ 1
m = popfirst!(arr)
n = popfirst!(arr)
push!(arr, m*n)
@show arr
end
標準出力
arr = [1, 2, 3, 4]
arr = [3, 4, 2]
arr = [2, 12]
arr = [24]
Discussion