<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>uraway</author_name>
  <author_url>https://blog.hatena.ne.jp/uraway/</author_url>
  <blog_title>文系プログラマー</blog_title>
  <blog_url>https://uraway.hatenablog.com/</blog_url>
  <categories>
    <anon>algorithm</anon>
  </categories>
  <description>配列の積和演算のアルゴリズム 「特別な配列」が与えられるので積和演算を行って値を返す。「特別な配列」は数値あるいは「特別な配列」をもつ。「特別な配列」内の数値をすべて加算するが、ネストレベルに応じてその和を乗算する。 例えば、 [x, y] → x + y [x, [y, z]] → x + 2(y + z) [1, [2, [3, 4]]] → 1 + 2 * (2 + 3 * (3 + 4)) → 47 アルゴリズム実装(1) $O(n)$ 再帰関数を別途作るのが楽。見たまんまで、配列ならdepthに1を加えて再帰関数を実行し、数値なら加算する。 function productSum(a…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Furaway.hatenablog.com%2Fentry%2F2020%2F02%2F19%2F070000&quot; title=&quot;配列の積和演算のアルゴリズム - 文系プログラマー&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2020-02-19 07:00:00</published>
  <title>配列の積和演算のアルゴリズム</title>
  <type>rich</type>
  <url>https://uraway.hatenablog.com/entry/2020/02/19/070000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
