Ice Base

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


Auto Painting

Master Nicola’s automated painting invention.

Nicola has built a semi-automatized painting system, but this system can paint only one side of an item. After that, an operator must reload the machine and paint the other side (the system detects painted sides automatically). The painting process always takes the same amount of time. The camera can paint K surfaces at a time. Nicola wants Stephan to operate the painting machine and he needs to develop an algorithm for Stephan which will allow him to paint N (0 < N ≤ 10) surfaces in the shortest possible timeframe. Be careful that you don't paint the item more than two times.
The items are numbered from 0 to 9. You are given the paint holding capacity of the machine (K) and the quantity of items (N). You should return the sequence Stephen must paint as a string, where each action is the numbers of painted items. Actions separated by comma (",").

Input: Capacity of the painting system (K) and quantity of items (N) as integers.
Output: The sequence of actions as a string.

How it is used:
This is similar to cooking two steaks in one pan. Both steaks have two sides and it takes a minute to cook each side, how would you cook both steaks in three minutes? This task takes the concept and models it in a technical way. The ideas behind the task also model real technological process in a factories.

ニコラは半自動塗装システムを組み立てたが, このシステムはアイテムの1面しか塗ることができない. その後, オペレータは機械をリロードし, 別の面を塗装する(システムは自動的に塗装面を決定する). 塗装プロセスは常に同じだけの時間がかかる. カメラは単位時間あたりK面だけ塗装できる. ニコラはステファンに塗装マシンを操作してもらいたいので, 彼はステファンのために, N(0 < N ≤ 10)面を塗装するのに最小時間で済むアルゴリズムを開発する必要がある. 同じアイテムを2回以上塗装しないように注意すること.
アイテムは0から9までの数字が割り振られており, あなたには機械の一度に塗装できる許容量(K)とアイテムの数(N)が与えられる. あなたはステファンが塗装すべきシーケンスを文字列として返す. シーケンスの数字(アクション)は塗装されたアイテムの数字である. アクションはコンマによって区切られる.

入力:塗装システムの容量(K)とアイテムの数(N)
出力:アクションのシーケンスを文字列として

備考
これは1つのフライパンの中の2つのステーキを焼くことに似ている. 2つのステーキはどちらも片面を1分ずつ焼く. 3分の間にどちらのステーキも調理するにはどうしたらよいだろうか? このタスクは技術的な方法でモデル化することを伝える. タスクの背後にあるアイデアは実際の工場でもまた技術プロセスをモデル化する.

Determinant

Put your math skills to the test and compute the determinant for a matrix.

In linear algebra, the determinant is a value associated with a square matrix. It can be computed from the entries of the matrix by a specific arithmetic expression (There are other ways to determine its value as well.)
The determinant of a matrix A is denoted det(A), det A, or |A|. In the case where the matrix entries are written out in full, the determinant is denoted by surrounding the matrix entries by vertical bars instead of the brackets or parentheses of the matrix.
There are various ways to define the determinant of a square matrix A, i.e. one with the same number of rows and columns. Perhaps the most natural way is expressed in terms of the columns of the matrix. If we write an N×N matrix in terms of its column vectors:
A = [a1, a2, ..., an]
Where there are vectors of size n, then the determinant of A is defined so that:
det[a1, ..., b*aj+c*v, ..., an] = b*det(A)+c*det[a1, ..., v, ..., an]
det[a1, ..., aj, aj+1, ..., an] = -det[a1, ..., aj+1, aj, ..., an]
det(I) = 1
Where b and c are scalars, v is any vector of size N and is the identity matrix of size N. These properties state that the determinant is an alternating multilinear function of the columns, and they suffice to uniquely calculate the determinant of any square matrix. Provided the underlying scalars form a field (more generally, a commutative ring with unity). Equivalently, the determinant can be expressed as a sum of products of entries of the matrix where each product has N terms and the coefficient of each product is −1 or 1 or 0 according to a given rule: it is a polynomial expression of the matrix entries. This expression grows rapidly with the size of the matrix (an NxN matrix contributes N! terms), so it will first be given explicitly for the case of 2×2 matrices and 3×3 matrices, followed by the rule for arbitrary size matrices, which subsumes these two cases.
For more information about the determinant visit Wikipedia

Input: A square matrix as a list of lists with integers.
Output: The determinant of the matrix as an integer.

How it is used:
The determinant is a basis for linear algebra and mathematical software. Linear algebra is used in vector graphics to calculate line paths and shapes. It can also be of use for many optimisation problems along with cryptography (videocipher) and geometry (testing for collinear points).

線形代数において, 行列式は正方行列に関連した値である. それは特有の計算表現によって行列の要素から計算される(その値を決定するための他の方法もまたある).
行列Aの行列式はdet(A), det A, |A|などと表記する. 行列の要素全てを書きだす場合, 行列式は行列の要素のまわりに, 行列で使われる丸括弧や羽括弧の代わりに, 垂線を書く.
行と列の数が同じ, すなわち正方行列Aの行列式を定義するための方法は様々ある. おそらく最も自然な方法は, 行列の列の項で表現される. NxN行列をその列ベクトルの項で書くと,
A = [a1, a2, ..., an]
ここで列ベクトルはサイズnであり, Aの行列式は次のように定義される.
det[a1, ..., b*aj+c*v, ...,an] = b*det(A) + c*det[a1, ..., v, ..., an]
det[a1, ..., aj, aj+1, ..., an] = -det[a1, ..., aj+1, aj, ..., an]
det(I) = 1
ここでbとcはスカラであり, vはサイズのNのベクトルで, サイズNの行列と同値である. これらの行列式の性質は列の交代多重線形性であり, それらはあらゆる正方行列の行列式を一意に計算するために十分である. 根本的なスカラー(より一般的には、まとまりのある可換環)フィールドを形成して提供される. 同等に, 行列式は行列の要素の積の和として表現される. ここでそれぞれの積はN項と-1か1か0の係数を持つ. 係数は行列の要素の多項式で与えられる. この式は行列のサイズが大きくなると急激に大きくなり(NxN行列だとN!項になる)ので, 2x2や3x3行列のために与えられる. 任意のサイズの行列に対しては, 2つのケースを包含する.

入力:リストのリストとして正方行列
出力:行列の行列式

備考
行列式は線形代数と数学ソフトウェアの基本である. 線形代数はベクタグラフィックスで線や球を計算するために使われる. それは多くの最適化問題, 暗号法(ビデオ暗号?)や幾何学(共線上の点のテスト)で使われる.

メモ
+ ...
2x2や3x3は演算が容易だが, 4x4以上になると大変なので, 小行列式展開を使って計算するよりもLU分解してUの対角要素の積を取ったほうが早い.
英訳してやっと気付いたが, この問題はLU分解について一言も触れてない.

Stair steps

Find the optimal path to maximize the sum of numbers on our mathematical stairs.

There is a staircase with N steps and two platforms; one at the beginning, the other at the end of the stairs. On each step a number is written (ranging from -100 to 100 with the exception of 0.) Zeros are written on both platforms. You start going up the stairs from the first platform, to reach the top on the second one. You can move either to the next step or to the next step plus one. You must find the best path to maximize the sum of numbers on the stairs on your way up and return the final sum.

Input: Numbers on each stair as a list of integers.
Output: The final sum for the best way as an integer.

How it is used:
This is a classical example of the optimisation problem. It can show you the difference between the various methods of programming; such as dynamic programming and recursion.

Nステップの階段と2つの足場がある. 足場の1つは開始地点で, もう1つは階段の終わりにある. それぞれのステップには数が書いてある(0を除いた-100から100までの数). 0は両方の足場に書かれる. あなたは最初の足場から階段を昇り始め, 次の足場まで進む. あなたは次の段か更にその次の段のどちらかに動ける. あなたは階段をのぼるときの数の和の最大値の経路を見つけ, その和を返す.

入力:それぞれの段の数のリスト
出力:最大の和

備考
これは最適化問題の古典的な例である. それはあなたに様々なプログラミングの手法, 動的計画法や再帰, の違いを見せる.

Counting tiles

Help construct a landing platform for the new Ice Base.

Nicola needs some help building a circular landing zone using the ice square tiles for their new Ice Base. Before he converts the area to a construction place, Nikola needs to figure out how many square tiles he will need.
Each square tile has size of 1x1 meters. You need to calculate how many whole and partial tiles are needed for a circle with a radius of N meters. The center of the circle will be at the intersection of four tiles. For example: a circle with a radius of 2 metres requires 4 whole tiles and 12 partial tiles.

Input: The radius of a circle as a float
Output: The quantities whole and partial tiles as a list with two integers -- [solid, partial].

How it is used:
This task is a simple geometry problem; but you can use it for architecture and topography. As we see in the description, you can calculate the amount of materials needed for a project.

ニコラは彼らの新しいアイスベースのために氷の正方のタイルを使い, 円状の着陸地点を建てる手助けを必要としている. 彼が工事現場のエリアを変換する前に, ニコラはいくつの正方タイルが必要かを示す必要がある.
それぞれのタイルは1平方メートルのサイズを持つ. あなたは半径Nメートルの円の中にある正方のタイルと, 部分的なタイルの数を計算する必要がある. 円の中心は4つのタイルの交点になる. たとえば, 半径2の円は4つの正方タイルと12個の部分的なタイルを含む.

入力:円の半径を浮動小数で
出力:[solid, partial]という形式のリストで, それぞれ正方のタイルと部分的なタイルの数

備考
このタスクは単純な幾何学の問題であるが, あなたは建築学やトポロジーにも使うことができる. 私たちは説明で見るように, プロジェクトに必要な量の素材を計算できる.

Convex Hull

Using only a set of coordinates, design a convex hull.

You are given a list of points on a coordinate plane. We need you find the convex hull formed by these points. The convex hull of a set X of points in the Euclidean plane is the smallest convex set that contains X. For instance: when X is a bounded subset of the plane, the convex hull may be visualized as the shape formed by a rubber band stretched around X. If a point lies on edge, it's included. You can read more about a convex hull on Wikipedia
The points are presented as a list of coordinates [x, y] in which x and y are integers. The result returns as a sequence of indexes of points in the given list; points lie on the convex hull in clockwise order (see the picture). The sequence starts from the bottom leftmost point. Remember: You should return a list of indexes--not the points themselves.

Input: A list of coordinates. Each coordinate is a list of two integers.
Output: The list of indexes of coordinates from the given list.

How it is used:
Convex hulls have practical applications in pattern recognition, image processing, statistics, GIS and static code analysis by abstract interpretation. The concept also serves as a tool and a building block for a number of other computational-geometric algorithms such as the rotating calipers method for computing the width and diameter of a point set.

あなたに二次元平面における点のリストが与えられる. 私たちはこれらの点が形成する凸閉包をあなたに見つけてもらう必要がある. ユークリッド平面における点の集合Xの凸閉包とは, Xを含む最小凸集合である. たとえば, Xが平面の制限された部分集合であるとき, 凸閉包は, おそらくXのまわりに輪ゴムをひっかけたような形になるだろう. 点が端にあるなら, それは含まれる. あなたはWikipediaで凸閉包について詳細を読むことができる.
整数x, yと使って, 点は座標のリスト[x, y]で表現される. 結果は与えられた点のリストのインデックスのシーケンスとして返す. 点は凸閉包の上にあり, 時計回りの順序になる(図を参照のこと). シーケンスは左下かた始める. あなたが返すのはインデックスのリストであって, 点のリストではないことを忘れないように.

入力:座標のリスト. それぞれの座標は2つの整数のリストからなる.
出力:与えられたリストの座標のインデックスからなるリスト.

備考
凸閉包はパターン認識, 画像処理, 統計, 地理情報システムや絶対解釈による静的コード分析など実用的なアプリケーションがある. このコンセプトもまた点集合の幅と直径を計算するためのRotatingCalipers法などの他の計算幾何アルゴリズムのためのツールおよび基礎として役に立つ.

メモ
+ ...
RotatingCalipers法は固有名詞. 凸閉包問題を解くためのアルゴリズムらしい.

Water Jars

Using two jars, figure out how much water is in the lake.

You stand by the edge of a lake with two empty jars. You notice that both of the jars have a volume. You can fill each jar with water from the lake, pour water from one jar to the other or pour water back into lake. You should measure the volume of water in either jar. The required volume of water may be in either of the jars and it does not matter which.
Each action is described as a string of two symbols: from and to. The jars are marked as 1 and 2, the lake is marked 0. If you want to take water from the lake and fill first jar, then it's "01". To pour water from second jar into the first would be "21". Dump water out of the first jar and back into the lake would be "10". When you fill a jar from the lake, that jars volume will be full. When you pour water out a jar and into the lake, that jars volume will be empty. If you pour water from one jar to another, you can only pour as much as will fill the full volume of the receiving jar.
The function has three arguments: The volume of first jar, the volume of second jar and the goal. All arguments are positive integers (number > 0). You should return a list with action's sequence.
The solution must contain the minimum possible number of steps

Input: The volume of first jar, the volume of second jar and the goal as integers.
Output: The sequence of steps as a list with strings.

How it is used:
This is a kind of optimisation problem with restrictions. It can be used for the development of the technological process and reducing cost of manufacturing.

あなたは湖の端で2つの瓶を持って立っている. あなたは両方の瓶が容量があることに気づいた. あなたは湖からそれぞれの瓶に水を満たしたり, 1つの瓶から別の瓶に水を移したり, 瓶の水を湖に戻したりできる. あなたはどちらかの水の容量を量る. 必要な水の容量はおそらく瓶のどちらであってもよく, それは問題ではない.
それぞれのアクションは2つのシンボルの文字列として記述する. すなわち「from and to」だ. 瓶は1と2としてマークされ, 湖は0としてマークされている. あなたが湖から, 最初の瓶に水を満たそうとするなら, それは"01"と書く. 最初の瓶から次の瓶に水を注ぐための表記は"21"だ. 最初の瓶の水を湖に戻すなら"10"だ. あなたが湖から他に水を入れるなら, 瓶は満タンになる. あなたが瓶から湖に水を捨てるとき, 瓶の中身は空になる. もしあなたが一方の瓶からもう一方への瓶に水を注ぐなら, 受け取る側の瓶の最大容量までしか入れることはできない.
この関数は3つの引数を持っている. 最初の瓶の容量, 次の瓶の容量, そしてゴールとなる容量だ. すべての引数は正の整数だ. あなたはアクションのシーケンスをリストとして返す.
解は最小ステップ数でなければならない.

入力:最初の瓶の容量, 次の瓶の容量, ゴールの容量
出力:ステップのシーケンスを文字列のリストとして

備考
これは制約条件のある最適化問題の一種だ. 技術処理や製造コストの減少の開発のために使われる.

Number Guess

You are given an unknown number. Your task is to guess what the number is, within 8 guesses.

You are given an unknown number within the range of 1 to 100, inclusive. Your task is to guess what the number is by performing a series of guesses.
Your solution will need to guess the number by submitting an integer divisor ranging from 2 to 10, and the number you guessed. At each attempt you will get information as a list of tuples. Each tuple contains the remainder result along with your previous divisor.
You should find the number within 8 guesses. We will give you a little extra info on your first attempt... Use it wisely young grasshopper...

Input: Information about the previous attempt. A list of tuples. Each tuple contains its remainder and the previous divisor.
Output: A list of integer divisors and your best guess. A list of two integers.

あなたに1から100までの未知の数字が与えられる. あなたのタスクは推測の連続を行うことによって, 何の数か推測する.
2から10, そしてあなたが推測した数が整数の除数として渡されることによってあなたの解法は数を推測する必要がある. それぞれの試みはあなたにタプルのリストを情報として与える. それぞれのタプルは前の除数とその剰余を含む.
あなたは8回の推測の間に数を見つける必要がある. 私たちはあなたに小さな特別な情報をあなたの最初の試みに与える. 若いバッタはそれを賢く使う.

入力:前の試みについての情報. タプルのリスト. それぞれのタプルは未知数の剰余と前の除数を含む.
出力:除数とあなたの推測のリスト, 2つの整数のリスト.

Cipher Crossword

Decipher the cipher crossword using your coding skills.

Everyone has tried solving a crossword puzzle at some point in their lives. We're going to mix things up by adding a cipher to the classic puzzle. A cipher crossword replaces the clues for each entry with clues for each white cell of the grid. These clues are integers ranging from 1 to 26, inclusive. The objective, as any other crossword, is to determine the proper letter for each cell. In a cipher crossword, the 26 numbers serve as a cipher for those letters: cells that share matching numbers are filled with matching letters, and no two numbers stand for the same letter. All resulting entries must be valid words.
For this task you should solve the cipher crossword. You are given a crossword template as a list of lists (2D array) with numbers (from 0 to 26), where 0 is a blank cell and other numbers are encrypted letters. You will be given a list of words for the crossword puzzle. You should fill that template with a given word and return the solved crossword as a list of lists with letters. Blank cells are replaced with whitespaces (0 => " ").
The words are placed in rows and columns with NO diagonals. The crossword contains six words with 5 letters each. These words are placed in a grid.

Input: The Cipher Crossword as a list of lists with integers. Words as a list of strings.
Output: The solution to the Crossword as a list of lists with letters.

How it is used:
This is a type of restriction problem. You have rules and should try to find a combination that conforms to these rules. This concept can help you to solve scheduling conflicts and - a situation where you would encounter many variables and restrictions, among other things.

みんなは人生の中のいくつかの点でクロスワードパズルを解いたことがあるだろう. 私たちは古典的なパズルに暗号を加えて混ぜてみた. 暗号クロスワードは, グリッドの空セルに入る文字の手がかりを置き換えたものだ. これらの手ががりは1から26の整数である. 他のクロスワードの目的は, それぞれのセルに適切な文字を決定することである. 暗号クロスワードにおいては, 26の数は文字の暗号として役に立つ. 共有のマッチする数字は, マッチする文字に相当し, 2つの数は同じ文字を示さない. 結果は妥当な単語になる.
このタスクのためにあなたは暗号クロスワードを解く. あなたには0から26までの数字を含んだリストのリスト(2次元配列)としてクロスワードのテンプレートが与えられる. ここで0は空のセルであり, 他の数字は暗号化された文字である. クロスワードパズルのための単語も同時に与えられる. あなたは与えられた単語を使ってテンプレートを満たし, 文字を入れたリストのリストとしてクロスワードの解を返す. 空セルは空白に置き換える.
単語は行か列で配置され, 斜めでは配置されない. クロスワードは5文字の6つの単語を含む. これらの単語はグリッドに配置される.

入力:整数を含んだリストのリストとして暗号クロスワード, 単語は文字列のリスト
出力:文字を含んだリストのリストとしてクロスワードの解

備考
これはある種の制約問題である. あなたはルールに従った組み合わせを見つけようとしなければならない. このコンセプトはスケジュール衝突, あなたが多くの変化や多くの間の制約に遭遇するシチュエーションを解く助けとなる.

Colder-Warmer

Let's play a game of hide and seek! Use your coding skills to find your hidden opponent!

Let's play a game of hide and seek. You have been given a map of 10x10 cells and in one of the cells we've hidden your goal. You can move to and from any cell in the field. On each move you'll get informed if the move places you closer or further away from your goal, compared to your previous location. Your function compiles data about previous steps, each step is a list of list, where first and second elements are your coordinates (row and column) and third is the info on how much closer you've gotten (colder or warmer) -- "colder" is -1, "warmer" is 1 and "same" is 0. For your measurement of the distance to the goal you should use the Euclidean distance. At each step you need to return the coordinates for your next step. If your step places you within the goal cell, then you win! You should find the goal within 12 steps.

Input: Information about previous steps as a list of lists. Each list contains coordinates and status alteration (warm, cold same).
Output: The coordinates of your new move as a list of two integers.

How it is used:
Use this concept to find something with indirect data such as a beeping sound (like a metal detector or rad counter). This is a prediction problem and you can use it in machine learning.

かくれんぼをしよう. あなたには10x10のマップが与えられ, セルのどれかに私たちが隠したあなたのゴールがある. あなたはフィールド内のどのセルにも動くことができる. それぞれの移動であなたは前にいた位置と比較して, ゴールに近づいたか遠ざかったかの情報を得る. あなたの関数は前のステップのデータを集めており, それぞれのステップはリストのリストとなる. ここで最初と次の要素はあなたの座標(行と列)で, 3番目はあなたが得たどれくらい近いかどうかの情報である(colder or warmer). "colder"は-1, "warmer"は1, "same"は0である. ゴールまでの距離はユークリッド距離を使う. それぞれのステップであなたは次のステップのための座標を返す必要がある. あなたのステップがゴールセルなら, あなたの勝利だ. あなたはゴールを12ステップ以内で見つけなければならない.

入力:リストのリストとして前のステップの情報. それぞれのリストは座標とゴールまでの情報(近い, 遠い, 同じ)を持つ.
出力:2つの整数のリストとして, 移動先の座標.

備考
このコンセプトはビープ音(金属検知器や放射線測定器のような)などの間接データを探すのに使われる. これは予想問題で, あなたは機械学習で使うだろう.

Reverse engineer

Recover your expression by using the math machine.

You are standing next to a math machine which takes two numerical inputs x and y, and has a single numerical output. It is known that the machine evaluates an expression using x, y, the operators + – * / and brackets. You should recover the expression by using the machine and the inputs of your choice over several turns. x, y and the result you receive are integers. The machine uses real division(/) in the expression. When dividing by zero, the result will evaluate to "ZeroDivisionError".
Equivalent expressions will be accepted by the grader. For this the machine evaluates your expression and the hidden expression several times using random values.
In each step your function gets a list with data from the past steps. Each element is a list of three numbers -- x(int), y(int) and output(a fraction as a list or the string "ZeroDivisionError"). The output is represented as a list with two integers - numerator and denominator.
The function should return a list with three elements -- your guess as an expression string, x and y, as integers.

Input: A list with data from the past steps.
Output: A list with three elements -- your guess as an expression string, x (int) and y (int).

How it is used:
The concepts used in this task can help you to understand someone else’s code and add new techniques to your own repertoire. In addition to this, reverse engineering comes in handy in cryptology where it can be used to decrypt coded information.

あなたは2つの数値x, yを入力とし, 1つの数値を出力する数学マシンの隣に立っている. それはx, yと, 演算子+ - * / と括弧を使った数式の評価マシンとして知られている. あなたは何ターンか好きな入力を行い, マシンを使うことによって数式を取り戻す. x, yと結果は整数としてあなたは受け取る. マシンは数式内で実除算を使う. 0除算したとき, 結果は"ZeroDivisionError"となる.
等価な数式はgraderによって受け取られる. このマシンの評価のために, あなたの数式と隠された数式を何度か乱数で行う.
それぞれのステップであなたの関数は前のステップからのデータをリストとして得る. それぞれの要素はx(int), y(int), 出力(リストで表現された分数か, "ZeroDivisionError"の文字列). 出力は2つの整数で表現される, 分子と分母である.
関数は3つの要素を持つリストを返すべきである, あなたの推測した数式の文字列と2つの整数x, yである.

入力:前のステップからのデータのリスト
出力:3つの要素を持ったリスト, 推測した数式と2つの整数x, y

備考
このコンセプトははこのタスクがあなたに誰かが書いたコードを理解させるのを助け, あなた自身の新しい技術のレパートリーを追加することである. これに加えて, リバースエンジニアリングは暗号化された情報を解読するのに使われる暗号学で役に立つ.

Funny addition

Try to find a fun solution for the usual task.

We have an array of two positive integers. Add these two numbers together.

Input: A list of two elements. Each element is a positive integer.
Output: The sum of two numbers.

私たちは2つの整数の配列を持っている. この2つを足せ.

入力:2つの要素を持つリスト, それぞれの要素は正の整数.
出力:2つの数の和.

メモ
+ ...
サービス問題ではなく, 「如何に面白おかしく2つの数の和のコードを書くか」という問題の模様.
最終更新:2014年04月17日 03:53