Alice In Wanderland

CheckIO Alice In Wanderlandの問題和訳
問題ページのうち, 問題の前提となる小話は訳してません.
また各問題ページ下部にある「Precondition」は「前提条件」のため訳しません(数値の範囲などだけなので).

Humpty Dumpty Form

Nicola wants to build his own robotic "Humpty Dumpty" and needs to determine how much material is required for its construction.

After reading this fragment Nicola wants to build his own "Humpty Dumpty". As a basis he chooses the spheroid (read more about it on Wikipedia). We know the height and the width (in inches) for this spheroid. For the job at hand, Nikola needs to know how much material is required.
You can help him and create a function to calculate the volume (cubic inches) and the surface area (square inches).

Hints:
Be careful with sin-1x -- this is arcsin.

Input: Two arguments. A height and a width as integers.
Output: The volume and the surface area as a list of floats. The results should be accurate to two decimals.

How it is used:
This is a simple math task, but we want to introduce you to the splendid shape -- spheroid (in case you hadn't heard of it yet).
The prolate spheroid is the shape of the ball in several sports, such as in rugby and Australian football. In American football, a more pointed prolate spheroid is used. Several moons of the Solar system approximate prolate spheroids in shape, though they are actually scalene. Examples are Mimas, Enceladus, and Tethys which orbit Saturn and Miranda which orbits Uranus.
The true shape of the Earth is called an Oblate Spheroid, though it is only very slightly oblate. The diameter from the North Pole to the South Pole (the shortest diameter) is approximately 12,714 km. The equatorial diameter (the longest diameter) is approximately 12,756 km. This is not a big difference, but it does mean the Earth is not quite a sphere.

ニコラはこの断片(問題上部の小話のこと)を読んだ後, "Humpty Dumpty"を組み立てたくなった. 彼は基礎として回転楕円体を選んだ. 私たちは回転楕円体に高さと幅(どちらもインチ)があることを知っている. 手で作る前に, ニコラはどれくらいの素材が必要かを知る必要がある.
あなたは彼を助けるのに体積と表面積を計算する関数を作る.

ヒント
sin^-1(x)はarcsinであることに注意.

入力:2つの引数, 高さと幅.
出力:体積と表面積を浮動小数点のリストで. 結果は小数点第二位までとする.

備考
これは単純な数学のタスクだが, 私たちは素敵な形, 回転楕円体(この時点でまたあなたが聞いたことがないもの)を紹介する.
扁長楕円体はいくつかのスポーツ, ラグビーやオーストラリアンフットボールなどでのボールの形だ. アメリカンフットボールでは, 更にとがった扁長楕円体が使われる. 太陽系のいくつかの月はほぼ編長楕円体で, それらはたしかに不等辺だ. たとえばミマス, エンケラドゥス, テティスなどの土星の衛星や, 天王星の衛星のミランダなどだ.
地球の正しい形は, ほんの少しだけ扁円のため, 扁円楕円体と呼ばれる. 北極から南極までの直径(最短直径)はほぼ12,714kmだ. 赤道の直径(長いほうの直径)はほぼ12,756kmだ. これは大きな違いではないが, 地球が球体ではないことを意味している.

Saw the Stick

Help the robots calculate the lengths of stick they need for their construction project.

The robots want to saw the stick in several pieces. The length of the stick is N inches. We should help our robots saw the stick. All of the parts should have integer lengths (1, 2, 3 .. inches, but not 1.2). As we love the numerical series and especially the Triangular numbers (read more about Triangular numbers on Wikipedia), you should saw the stick so that the lengths form the consecutive fragment of the Triangular numbers series with the maximum quantity (fragment's length). The parts should have different lengths (no repeating). For example: 64 should divided at 15, 21, 28, because 28, 36 is shorter and 1, 3, 15, 45 is not a consecutive fragment.
You are given a length of the stick (N). You should return the list of lengths (integers) for the parts in ascending order. If it's not possible and the problem does not have a solution, then you should return an empty list.

Input: A length of the stick as an integer.
Output: A fragment of the Triangular numbers as a list of integers (sorted in ascending order) or an empty list.

How it is used:
In this task you will learn about triangular numbers. A triangular number or triangle number counts the objects that form an equilateral triangle. This is an interesting sequence which has various applications.
Here’s a real world application: In a competitive tournament format that uses a round-robin group stages, the number of matches that need to be played between n teams is equal to the triangular number Tn−1. For example, a group stage with 4 teams requires 6 matches, and a group stage with 8 teams requires 28 matches.

ロボットは木の棒をのこぎりでいくつかに切りたい. 棒の長さはNインチだ. 私たちはロボットに木の棒を切らせるのを助ける. 切った木の棒はすべて整数の長さになる. 私たちは数列, とりわけ三角数(詳しくはWikipediaを参考のこと)を好む. あなたは木の棒をのこぎりで切る. このとき, 切った木の棒の長さが連続した三角数の数列になるようにし, さらにその数列が一番長くなるようにする. 切った木の棒は異なる長さでなければならない. たとえば, 64は12と21と28になる. 28と36は短すぎるし, 1, 3, 15, 45は連続でない.
あなたには木の棒の長さNが与えれる. あなたは昇順にソートした長さのリストを返す. もし連続した三角数の数列にできないなら, その問題は解を持たないとして, 空のリストを返す.

入力:木の棒の長さN
出力:昇順にソートされた断片の三角数の数列をリストで. 解がない場合は空のリスト

備考
このタスクではあなたは三角数について学ぶ. 三角数ないし三角の数は数え上げると三角形を成す. これは様々な応用先を持つ興味深い数列だ.
ここで実世界の応用例を見よう. トーナメント形式の大会ではラウンドロビン形式が使われる, このときのnチーム間のマッチ数は三角数Tn-1に等しい. たとえば, 4チームが出場する場合, 試合数は6になり, 8チームの場合は28試合になる.

The Hidden Word

Nicola needs a tool that searches for keywords in poetry to help on his English homework.

Nicola has solved this puzzle (and I am sure that you will do equally well). To be prepared for more such puzzles, Nicola wants to invent a method to search for words inside poetry. You can help him create a function to search for certain words.
You are given a rhyme (a multiline string), in which lines are separated by "newline" (\n). Casing does not matter for your search, but whitespaces should be removed before your search. You should find the word inside the rhyme in the horizontal (from left to right) or vertical (from up to down) lines. For this you need envision the rhyme as a matrix (2D array). Find the coordinates of the word in the cut rhyme (without whitespaces).
The result must be represented as a list -- [row_start,column_start,row_end,column_end], where
row_start is the line number for the first letter of the word.
column_start is the column number for the first letter of the word.
row_end is the line number for the last letter of the word.
column_end is the line number for the last letter of the word.
Counting of the rows and columns start from 1.

Input: Two arguments. A rhyme as a string and a word as a string (lowercase).
Output: The coordinates of the word.

How it is used:
This task shows the variance of the positional ciphers. With this cipher you can hide a message within a book which allows you and receiver to send these coded messages.

ニコラはこのパズルを解いた(私はあなたも解くだろうと確信している). より大変なパズルの準備のために, ニコラは詩に含まれる単語を検索するメソッドを発明したい. あなたは彼が特定の単語を検索する関数を作る手助けをする.
あなたには韻文が与えられる. ここで行は改行(\n)で区切られる. あなたの探索に関係ないので, 空白は検索前に取り除いておく. あなたは韻文の中に水平に(左から右へ)か垂直に(上から下に)続く単語を見つける. あなたは韻文を2次元配列のように考える. 切り取られた韻文の中の単語の座標を見つける.
結果はリストとしなければならない. 形式は[行の始点, 列の始点, 行の終点, 列の終点]である.
行の始点は単語の最初の文字の行のことである.
列の始点は単語の最初の文字の列のことである.
行の終点は単語の最後の文字の行のことである.
列の終点は単語の最後の文字の列のことである.
行と列は1から数え始めること.

入力:2つの引数, 文字列の韻文と, 文字列の単語(小文字)
出力:単語の座標

備考
このタスクはあなたに位置暗号の分散を見せる. この暗号はあなたに本の中に隠れたメッセージをもたらす. その本はあなたと受け取り人に暗号化されたメッセージを送る.

Multiplication Table

"Alice's Adventures in Wonderland" inspired our robots to create their own Multiplication Table. One little problem: Stephan forgot how to do multiplication…

After reading "Alice's Adventures in Wonderland," our robots decided to create their own "Multiplication table." Stephan would lead this mission (yeah, that probably was a bad idea). He forgot how to do multiplication and tried to invent a new method. It’s a rather strange method if we may be so blunt.
In Stephan's version of multiplication, we convert numbers to binary representation without trailing zeroes. Then the first number is written vertically (up to down) and the second horizontally (left to right). With that, we fill a table with various binary operations for each crossing -- AND, OR, XOR, so we end up with three tables. In each table we convert rows to decimal and summarize it, then summarize the results of three tables. Let's look at several examples.
You should help Stephan write a function to calculate this "multiplication". You are given two positive integers (n > 0), be careful with order of arguments.

Input: Two arguments as integers.
Output: The result of the Stephan's "multiplication", an integer.

How it is used:
In this task we play around with logical binary operations, the basis for computer science. Maybe you can find a use for this subject in cryptography?

アリスのワンダーランドの冒険を読んだ後, 私たちのロボットは掛け算テーブルを作ることを決めた. ステファンはこのミッションを導くだろう(たぶん悪いアイデアだろう). 彼は掛け算の仕方を忘れ, 新しいメソッドの発明を試みた. それは私たちがとても鈍感なら, どちらも奇妙なメソッドだ.
ステファンの掛け算のバージョンでは, 私たちは連続した0を除いたバイナリで表現するために数字を変換する. 最初の数は垂直(上から下に)書き, 次の数は水平に(左から右に)書く. そして, 表を様々な2進数の演算子, AND, OR, XORを使って埋める. そのため3つの表を得る. それぞれの表は列を10進数に変換し, それらの和を取る. そして3つの表の結果の和を取る. いくつか例を見てみよう.
あなたはステファンがこの掛け算を計算するための関数を書く手助けをする. あなたには正の整数が2つ与えられる. 引数の順序に注意せよ.

入力:2つの整数
出力:ステファンの掛け算の結果

備考
このタスクは私たちに論理的な2進数の演算, コンピュータ科学の基礎, を遊ばせる. おそたくあなたは暗号法の中にこの問題の使い方を見つけるだろう.

Digits Doublets

Doublets is a word game, and we’re rewriting the rules!

Doublets, sometimes known as Word ladder, is a word game invented by Charles Dodgson (aka Lewis Carroll). A doublets puzzle begins with two words. To solve the puzzle one must find a chain of different words to link the two together such that the two adjacent words differ by one letter.
For Example: FLOUR ⇒ FLOOR ⇒ FLOOD ⇒ BLOOD ⇒ BROOD ⇒ BROAD ⇒ BREAD
The Robots like using digits more than letters, so we’ve changed the rules little. You are given the list of numbers with exactly the same length and you must find the shortest chain of numbers to link the first number to the last like you would with the words.
For Example. There is a list [123, 991, 323, 321, 329, 121, 921, 125, 999]. The shortest way from the first to the last is: 123 ⇒ 121 ⇒ 921 ⇒ 991 ⇒ 999
You should write a function that receiveы a list of numbers (positive integers) and returns the shortest route as a list of numbers.

Input: Numbers as a list of integers.
Output: The shortest chain from the first to the last number as a list of integers.

How it is used:
This task is like pathfinding for numbers. It shows how many things in this world can be represented with mathematics, even words.

時々言葉の梯子とも知られるダブレットとは, チャールズ・ドジソン(別名ルイス・キャロル)によって発明された言葉遊びである. ダブレットパズルはまず2つの単語で始める. パズルを解くために, 2つの単語の間に隣り合う単語が1文字ずつ異なるように, 単語の連鎖を見つけなければならない.
たとえば, FLOUR ⇒ FLOOR ⇒ FLOOD ⇒ BLOOD ⇒ BROOD ⇒ BROAD ⇒ BREAD
ロボットは文字よりも数字を使うことを好むので, 私たちはルールを少し変えた. あなたには同じ長さの数字のリストが与えられる. あなたはその中から最初と最後の数字の間の最短連鎖を見つける.
たとえば, [123, 991, 323, 321, 329, 121, 921, 125, 999]というリストなら, 最初から最後への最短連鎖は123 ⇒ 121 ⇒ 921 ⇒ 991 ⇒ 999となる.
あなたは正の整数のリストを受け取り, その最短経路をリストとして返す.

入力:整数のリスト
出力:最初と最後の最短経路をリストで

備考
このタスクは数列の経路探索に似ている. それはこの世界の多くのものを数学として表現させることを示す.

The Rows of cakes

Loads of cakes are covering the floor and our robots want to find out why!

Someone has decided to bake a load of cakes and place them on the floor. Our robots can't help but try to find a pattern behind the cakes' disposition. Some cakes form rows, we want to count these rows. A row is a sequence of three or more cakes if we can draw a straight line through its centers. The greater row takes up the smaller rows. So if we have a row with 4 cakes, then we have only one row (not 4 by 3).
The cake locations are represented as a list of coordinates. A coordinate is a list of two integers. You should count the rows.

Input: Coordinates as a list of lists with two integers.
Output: The quantity of rows as an integer.

How it is used:
This is an example of the image and pattern recognition. This concept can be useful for the game mechanics or if you want to write a bot for games, or when transposing printed text to a digital format.

誰かがたくさんのケーキを焼くことを決め, それらをフロアに置くことにした. 私たちのロボットはケーキの配置の裏にあるパターンを見つけようとしたが出来なかった. いくつかのケーキは直線状に列を作る, 私たちはこれらの列の数を数えたい. 3つ以上のケーキが並びを列とする. それはケーキの中心を通る直線を描くことができる. 大きい列の中にある小さな列はカウントしない. もし4つのケーキが列をなしているなら, その列は1つとして数える.
ケーキの位置は座標のリストとして表現される. 座標は2つの整数のリストからなる. あなたは列を数える.

入力:2つの整数を持ったリストのリストとして座標
出力:列の数

備考
これは画像とパターン認識の例だ. このコンセプトはゲーム技術やゲームのbot, デジタル形式のテキストを印刷するときなどに使われる.
最終更新:2014年04月18日 16:38