<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>obelisk2</author_name>
  <author_url>https://blog.hatena.ne.jp/obelisk2/</author_url>
  <blog_title>Camera Obscura</blog_title>
  <blog_url>https://obelisk.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>アルゴリズム・パズル</anon>
  </categories>
  <description>アルゴリズム・パズルです。問題。 1~9 のカードを横一列に適当に並べ替えます。そこからスタートして、左端のカードの数字の枚数だけ、左からカードを取って逆順にし、また置き直します。例えば [4, 5, 6, 7, 8, 9, 1, 2, 3] だったら [7, 6, 5, 4, 8, 9, 1, 2, 3] とします。これを繰り返すと、左端が 1 になったら終了することがわかります。 さて、終了するまでの手順がもっとも長くなる初期配置を与えなさい。 Ruby で解きます。 q40.rb def try(order, co) 8.times do |i| if order[i + 1] == i…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2018%2F01%2F04%2F111309&quot; title=&quot;並べ替えの繰り返し（Ruby） - Camera Obscura&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>https://images-fe.ssl-images-amazon.com/images/I/51UODCJtLqL._SL160_.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2018-01-04 11:13:09</published>
  <title>並べ替えの繰り返し（Ruby）</title>
  <type>rich</type>
  <url>https://obelisk.hatenablog.com/entry/2018/01/04/111309</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
