<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>inamori</author_name>
  <author_url>https://blog.hatena.ne.jp/inamori/</author_url>
  <blog_title>inamori’s diary</blog_title>
  <blog_url>https://inamori.hateblo.jp/</blog_url>
  <categories>
    <anon>Scala</anon>
  </categories>
  <description>Problem 86直方体の3辺の長さをp, q, r(p &lt; q &lt; r)とすると、距離の自乗は (p + q)2 + r2 なのでこれが平方数ならば最短経路が整数になります。直方体の数を求める最も簡単な方法はp, q, rを列挙することです。これはO(M3)かかります。これでは箸にも棒にもかからなそうですが、実際に組んでみるとそうでもないです。解の探索に単純な二分探索ではなく、Mのとき直方体の個数はだいたいO(M2logM)くらいなので、2点がわかっていれば解を推定できます。実際には簡単のために、cMdと仮定して2点を通るように解を推定します。最初の方はとんでもなく大きいMになって計算量が…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20120117%2Fp1&quot; title=&quot;ScalaでProject Euler（126） - inamori’s diary&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>2012-01-17 00:00:00</published>
  <title>ScalaでProject Euler（126）</title>
  <type>rich</type>
  <url>https://inamori.hateblo.jp/entry/20120117/p1</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
