Mine

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


Skew-symmetric matrix

Discover if a square matrix is skew-symmetric.

In mathematics, particularly in linear algebra, a skew-symmetric matrix(also known as an antisymmetric or antimetric) is a square matrix A whose transpose is also its negative. This means it satisfies the equation A = −A^T. If the entry in the i-th row and j-th column is aij, i.e. A = (aij) then the symmetric condition becomes aij = −aji.
You should determine whether the specified square matrix is skew-symmetric or not.
You can find more details on Skew-symmetric matrices on its Wikipedia page.

Input: A square matrix as a list of lists with integers.
Output: If the matrix is skew-symmetric or not as a boolean.

How it is used:
Skew-symmetric matrices can be useful for the cross product, an operation in mathematics used in the calculation of movement of forces. Matrixes are basis for the linear algebra and vector graphics.

数学のとりわけ線形代数において, 歪対称行列(反対称行列とも知られる)とは正方行列Aが自身の転置の-1倍と等しいものを言う. これはA = -A^Tという方程式を意味する. i行目とj列目の要素a_ijは, 条件から, a_ij = -a_jiとなる.
あなたは正方行列が歪対称行列かどうかを判定する.
歪対称行列について詳しくはWikipediaを参照のこと.

入力:リストのリストで表現された正方行列, 要素は整数
出力:歪対称行列かどうか, boolean

備考
歪対称行列はクロス積(外積), 力の移動の計算などの操作でよく使われる. 行列は線形代数とベクタグラフィックスの基礎である.

Flatten a list

Make out Nicola's nested list and tweet how you did it.

Nicola likes to categorize all sorts of things. He categorized a series of numbers and as the result of his efforts, a simple sequence of numbers became a deeply-nested list. Sophia and Stephan don't really understand his organization and need to figure out what it all means. They need your help to understand Nikolas crazy list.
There is a list which contains integers or other nested lists which may contain yet more lists and integers which then… you get the idea. You should put all of the integer values into one flat list. The order should be as it was in the original list with string representation from left to right.
We need to hide this program from Nikola by keeping it small and easy to hide. Because of this, your code should be shorter than 140 characters (with whitespaces).

Input data: A nested list with integers.
Output data: The one-dimensional list with integers.

How it is used:
This concept is useful for parsing and analyzing files with complex structures and the task challenges your creativity in writing short code.

ニコラはあらゆる物事を分類するのが好きだ. 彼はいくつかのシリーズを分類した結果, 単純なシーケンスは深くネストしたリストになった. ソフィアとステファンは彼の構成を理解できず, どのような意図があるかもわからなかった. 彼らはニコラのクレイジーなリストを理解するためにあなたの助けを必要としている.
整数または複数のネストしたリストがありあなたはアイデアを得ている. あなたは全ての整数を1つの平たんなリストにしなければならない. 順序は元のリストの左から右にたどったものとする.
私たちはこの問題をニコラから隠す必要がある. このため, あなたのコードは140文字以内(ホワイトスペースを含む)にしなければならない.

入力:ネストしたリスト
出力:1次元のリスト

備考
このコンセプトは複雑な構造のファイルを解析, 分析するのに使われたる. またこのタスクはあなたの創造性に対する挑戦である.

Call to Home

So-phie phone home.

1Nicola believes that Sophia calls to Home too much and her phone bill is much too expensive. He took the bills for Sophia's calls from the last few days and wants to calculate how much it costs.
The bill is represented as an array with information about the calls. Help Nicola to calculate the cost for each of Sophia calls. Each call is represented as a string with date, time and duration of the call in seconds in the follow format:
"YYYY-MM-DD hh:mm:ss duration"
The date and time in this information are the start of the call.
Space-Time Communications Co. has several rules on how to calculate the cost of calls:
  • First 100 (one hundred) minutes in one day are priced at 1 coin per minute;
  • After 100 minutes in one day, each minute costs 2 coins per minute;
  • All calls are rounded up to the nearest minute. For example 59 sec ≈ 1 min, 61 sec ≈ 2 min;
  • Calls count on the day when they began. For example if a call was started 2014-01-01 23:59:59, then it counted to 2014-01-01;
For example:
2014-01-01 01:12:13 181
2014-01-02 20:11:10 600
2014-01-03 01:12:13 6009
2014-01-03 12:13:55 200
First day -- 181s≈4m -- 4 coins;
Second day -- 600s=10m -- 10 coins;
Third day -- 6009s≈101m + 200s≈4m -- 100 + 5 * 2 = 110 coins;
Total -- 124 coins.

Input: Information about calls as a tuple of strings.
Output: The total cost as an integer.

How it is used:
This mission will teach you how to parse and analyse various types data. Sometimes you don't need the full data and should single out only important fragments.

ニコラはソフィアが何度も電話してくるため, 彼女の電話代が高額だと確信しています. 彼はここ数日のソフィアの電話代を取り, そのコストを計算したい.
請求書は電話の情報を伴った配列で表現される. ニコラがソフィアの電話代のそれぞれのコストを計算するのを手助けする. それぞれの電話は日, 時間, 通話時間(秒)を含んだ文字列で表現され, 以下のフォーマットに従う.
"YYYY-MM-DD hh:mm:ss 通話時間"
日付と時間は電話の開始時の情報である.
スペースタイムコミュニケーションズ会社は通話のコスト計算にいくつかのルールを決めている.
  • 1日のうち最初の100分は1分あたり1コイン
  • それ以降の100分は, 1分あたり2コイン
  • 全ての通話時間は最も近い分に切り上げる. たとえば59秒は1分で, 61秒は2分だ.
  • 通話は開始した日から数える. たとえばもし通話が2014-01-01 23:59:59から始まったなら, それは2014-01-01として数える.
たとえば
2014-01-01 01:12:13 181
2014-01-02 20:11:10 600
2014-01-03 01:12:13 6009
2014-01-03 12:13:55 200
初日 181秒≈4分 4コイン
2日目 600秒=10分 10コイン
3日目 6009秒≈101分 + 200秒≈4分 100 + 5 * 2 = 100コイン
合計 124コイン

入力:文字列のタプルとして通話に関する情報.
出力:合計コストを整数で.

備考
このミッションはあなたに様々な種類のデータの解析と分析について教える. 時々あなたは完全なデータを必要とせずに, 情報の重要な一部だけを選び出すだろう.

Pattern Recognition

Teach the robot’s drones to recognize basic patterns and flag them.

To explore new islands and areas Sophia uses automated drones. But she gets tired looking at the monitors all the time. Sophia wants to learn the drones to recognize some basic patterns and mark them for review.
The drones have a simple optical monochromatic image capturing system. With it an image can be represented as a binary matrix. You should write a program to search a binary matrix (a pattern) within another binary matrix (an image). The recognition process consists of scanning the image matrix row by row (horizontal scanning) and when a pattern is located on the image, the program must mark this pattern. To mark a located pattern change 1 to 3 and 0 to 2. >The result will be the image matrix with the located patterns marked.
The patterns in the image matrix are not crossed, because you should immediately mark the pattern.

Input: Two arguments. A pattern as a list of lists and an image as a list of lists.
Output: The marked image as a matrix as a list of list.

How it is used:
As we can see in the first paragraph, this task is simple monochromatic pattern recognition. You can take a monochrome image and find various subimages inside such as the alien spaceships in the Galaxy Game ;-)

新しい島を探索するためにソフィアは自動操縦ドローンを使う. しかし彼女は毎時間モニターを見るのに飽きた. ソフィアはレビューのためにドローンに単純な認識とマーク付けをさせることを学びたい.
ドローンはモノクロ写真を撮影するシステムを持っている. このとき画像は二進数の行列として表現される. あなたはバイナリ行列(画像)の中から, バイナリ行列(パターン)を検索するプログラムを書く. 認識処理は画像を走査(水平スキャン)によって構成され, パターンが画像の中で見つかると, プログラムはこのパターンをマークする. パターンが一致する箇所のバイナリを0なら2に, 1なら3にすることでマーキングする.
結果はパターンがマーキングされた画像になる.
画像内のパターンは交わらない.

入力:2つの引数. パターンとしてのリストのリスト, 画像としてのリストのリスト.
出力:リストのリストとしてマークされた画像。

備考
最初のパラグラフで見たように, このタスクは単純なモノクロ画像認識である. あなたはモノクロ画像を得, 銀河のゲーム内のエイリアンの宇宙船のように内部の様々なサブイメージを見つけることができる.

Cipher map

Write a cipher program to encode a secret password.

Help Sofia write a decrypter for the passwords that Nikola will encrypt through the cipher map. A cipher grille is a 4×4 square of paper with four windows cut out. Placing the grille on a paper sheet of the same size, the encoder writes down the first four symbols of his password inside the windows (see fig. below). After that, the encoder turns the grille 90 degrees clockwise. The symbols written earlier become hidden under the grille and clean paper appears inside the windows. The encoder then writes down the next four symbols of the password in the windows and turns the grille 90 degrees again. Then, they write down the following four symbols and turns the grille once more. Lastly, they write down the final four symbols of the password. Without the same cipher grille, it is difficult to discern the password from the resulting square comprised of 16 symbols. Thus, the encoder can be confident that no hooligan will easily gain access to the locked door.
Write a module that enables the robots to easily recall their passwords through codes when they return home.
The cipher grille and the ciphered password are represented as an array (tuple) of strings.

Input: A cipher grille and a ciphered password as a tuples of strings.
Output: The password as a string.

How it is used:
Here you can learn how to work with 2D arrays. You also get to learn about the ancient Grille Cipher, a technique of encoding messages which has been used for half a millenium. The earliest known description of the grille cipher comes from the Italian mathematician, Girolamo Cardano in 1550.

ソフィアがパスワードを解読するを手助けをしよう. そのパスワードはニコラが暗号化マップで暗号化したものだ. 暗号化格子は4×4の平方の紙で, 4つの窓が切り取られている. 同じサイズの紙に格子を置くと, エンコーダは窓の中にある彼のパスワードの最初の4つのシンボルを書きとめる(下記図参照). その後, エンコーダの格子を時計回りに90度回転させる. 前のシンボルは格子の下に隠れ, 窓の中には別のシンボルが現れる. エンコーダは窓の中にあるパスワードの次の4つのシンボルを書きとめ, 再び格子を90度回転させる. そして, 更に4つのシンボルを書きとめ, 更に回転させる. 最後に, パスワードの4つのシンボルを書きとめる. 同じ暗号化格子がなければ, 16のシンボルから構成される正方形のパスワードを識別することは困難である. したがって, エンコーダがよそ者がロックされたドアを容易に開けられないことを確信している.
ロボットが家に帰ってくるときに簡単なコードを通してパスワードを思い出すのを可能にするためのモジュールを書こう.
暗号化格子と暗号化されたパスワードは文字列の配列(タプル)として表現される.

入力:暗号化格子と暗号化されたパスワードを文字列のタプルとして.
出力:パスワードを文字列で.

備考
ここであなたは2次元配列の操作方法を学ぶことができる. 古代の格子暗号, 500年前に使用された符号化メッセージの技術について学ぶことができる. 最も古く知られる格子暗号の記述はイタリアの数学者で, 1550年のジェロラモ・カルダーノだ.

Buildings visibility

Determinate how many of the buildings are visible from the area just south of where we set up base.

The robots have requested your help setting up a new base on the island. They need you to define the visibility of a building from a specific direction, in this case, south. To help you out, you have been given a map of the buildings in the complex. The map is an orthogonal projection of each of the buildings onto a horizontal plane. It is oriented on a rectangular coordinate system so that the positive x-axis points east and the positive y-axis points north. No two buildings in the map overlap or touch. Each of the buildings have perfectly rectangular sides and are aligned from north to south and from east to west. The map is a list of buildings. Every building is presented as the list with coordinate of south-west corner, coordinate of north-east corner and height - [Xsw, Ysw, Xne, Yne, height]. We need to determinate how many of the buildings are visible from the area just south of the base (excluding the angle of vision, just using projection.) See the illustration below.

Input:A list of lists with buildings coordinates and heights. The coordinates are integers. The heights are integers or floats.
Output:The quantity of visible buildings, an integer.

How it is used:
Image recognition systems.

島で新しい基地を作るために, ロボットはあなたの助けを必要としている. ロボットは特定の方向から建物の視界を決めるためにあなたを必要とする. このケースでは南である. あなたを助けるために, あなたに複雑な建物のマップが与えられる. マップはそれぞれの建物の水平面への正投影である(俯瞰図). これは正を東とするx軸と正を北とするy軸の座標からなる. 2つの建物はマップの中で重ならない. それぞれの建物は完全な四角で, 北から南, 東から西に整列している. マップは建物のリストでもある. それぞれの建物は南西角の座標と北東角の座標と高さのリスト, [Xsw, Ysw, Xne, Yne, height]で表さられる. 私たちは基地の南からの視界に映る建物の数を数える必要がある(視野角などは除く, 平面だけを使う). 詳しくは下のイラストの通りだ.

入力:建物の座標と高さを含むリストの律祖. 座標は整数で, 高さは整数か浮動小数点.
出力:視認可能な建物の数, 整数.

備考
画像認識システムだ.

Painting Wall

How many times do you have to paint a wall?

Nicola has built a simple robot for painting of the wall. The wall is marked at each meter and the robot has a list of painting operations. Each operation describes which part of wall it needs to paint as a range from place to place, inclusively. For example: the operation [1, 5] means to paint the sections from 1 to 5 meters including sections 1 and 5. Operations are executed in the order they are placed in the list of operations. If the range of various operations are overlapped, then they must be counted once.
Stephan has prepared a list of operations, but we need to check it before the robot executes its painting plan. You are given the number of meters on the walls which need painting, (the painted zones can be separated by non painted parts) and the list of operations prepared by Stephan, you should determine the number of operations from this list required to paint the designated length of the wall. If it's impossible to paint that length with the given operations, then return -1.

Input: Two arguments. The required length of the wall that should be painted, as integer. The second is a list of the operations that contains the range (inclusive) as a list of two integers.
Output: The minimum number of operations. If you cannot paint enough of the length with the given operations, return -1.

Hint:
To handle the beginning-end of the list, you could try running a binary search.

How it is used:
This skillset is often used in computer simulations.

ニコラは壁を塗るために単純なロボットを組み立てた. 壁はメートルごとに区切られており, ロボットは塗装操作のリストを持っている. それぞれの操作は塗装を必要とする場所から場所への範囲として記述される. たとえば, [1, 5]という操作はセクション1と5を含む1から5mを塗装することを意味する. 操作はリストの順序に実行される. 様々な操作の範囲が重なっているときは, ただ1回だけカウントすべきである.
ステファンは操作のリストを用意するが, 私たちはロボットは塗装計画を実行する前に, チェックする必要がある. あなたにはステファンが用意した操作のリストと塗装に必要な壁の長さ(塗装エリアは塗装されない箇所で区切られる)の数が与えられる. あなたは壁の長さが示された, 塗装が必要なリストの操作の数から決定する. 与えられた操作が実行不可能な長さの場合, -1を返す.

入力:2つの引数. 塗装するのに必要な壁の長さと, 2つの整数からなる塗装範囲を含んだ操作のリストのリスト.
出力:操作の最小階数. 不可能な場合は-1.

ヒント
リストの開始から終わりまでの操作をするために, あなたは二分探索に挑むことができる.

備考
このスキルセットはコンピュータシミュレーションでしばしば使われる.

Palindromic Palindrome

Can you write a palindromic program with a function that checks for palindromes?

Write a palindromic program with a checkio(s) function that checks whether s (a string) is a palindrome.
For this task, using "#" is forbidden.
You can use other methods for the function's definition (for example a lambda). The test will try to run the function "checkio" from your code.
The example of the palindromic code:
checkio=lambda x: x#x :x adbmal=oikcehc
However, in your code, you can not use "#".

Input: A text as a string.
Output: Palindrome or not as a boolean.

How it is used:
This task is a challenge in creativity and is designed to show you the hidden depths of programming languages.

回文sかどうかを判定する回帰性のあるcheckio(s)関数を書こう.
このタスクのために, '#'を使うことは禁じる.
あなたは関数の定義のために他のメソッドを使うことができる(たとえばラムダ式など). テストはあなたのコードからcheckio関数を実行しようとする.
回帰性のあるコードの例をあげよう.
checkio=lambda x: x#x :x adbmal=oikcehc
ただしあなたのコードでは"#"は使用禁止だ.

入力:文字列としてテキスト
出力:回文かどうか, boolean

備考
このタスクはあなたの創造力への挑戦であり, プログラミング言語の隠された深層をあなたに見せるだろう.

Magic Square

Use your skills to finish an incomplete magic square.

In mathematics a magic square is an arrangement of numbers (integers in our case) in a square grid, where the numbers in each row, each column and the numbers in the forward and backward main diagonals, all sum up to the same number.
You have been given an incomplete magic square (with a size from 3 to 5). With your coding skills, you must finish the square. It must be a normal magic square and contain integers from 1 to n^2 without repeating. The square is presented as a list of lists with integers. Zero is used to mark an empty cell. >You should return a completed magic square. The task may have multiple solutions.
You can read more about the about Magic Squares on Wikipedia.

Input: A partially filled magic square as a list of lists with integers.
Output: The completed magic square as a list of lists with integers.

How it is used:
This is a constraint satisfaction problem. It's used not only for solving puzzles, but also for planning and resource allocation in city planning, construction and just about everywhere else.

数学の魔方陣とは, 正方形のグリッドに整数を配置するもので, ここで数字は行, 列, 並びに対角線の和が全て同じ値になるように配置しなければならない.
あなたには不完全な3x3~5x5の魔方陣が与えられる. あなたのコーディングスキルを使えば, 魔方陣を完成させられるはずだ. 普通の魔方陣は重複なしに1からn^2までの整数を含む. 魔方陣は整数を含んだリストのリストとして表現される. ゼロは空のセルのマークとして使われる.
あなたは完全な魔方陣を返す. このタスクは多重解を持つこともある.
魔方陣について詳しくはWikipediaにて.

入力:不完全な魔方陣, リストのリストとして表現される
出力:完全な魔法陣, リストのリストとして

備考
これは制約付き問題である. パズルを解くときだけでなく, 都市計画のリソース制限計画などでも使われる.

Mathematically Lucky Tickets

Determine whether a 6-digit number on a ticket is mathematically ‘lucky’ or not.

The "Mathematically lucky tickets" concept is similar to the idea of the Russian "Lucky tickets". It refers to the old public transport tickets that had 6-digit numbers printed on them.
You are given a ticket number and the combination of its digits can become a mathematical expression by following these rules.
1. The digits of the number can be split into groups of numbers.
2. You cannot change the order of groups or digits.
3. Each group is treated as a one integer number. (1 and 2 would become 12, etc.)
4. Operational signs (+, -, * and /) are placed between the groups.
5. Parenthesis are placed around subexpressions to eliminate any ambiguity in the evaluation order.
For example:
* 238756 -> (2 * (38 + ((7 + 5) * 6)))
* 000859 -> (0 + (00 + (8 + (5 + 9))))
* 561403 -> (5 * (6 + (1 + (40 / 3))))
The ticket is considered mathematically lucky if no combination of its digits evaluates to 100. For example:
* 000000 is obviously lucky, no matter which combination you construct it always evaluates to zero,
* 707409 and 561709 are also lucky because they cannot evaluate to 100
* 595347 is not lucky: (5 + ((9 * 5) + (3 + 47))) = 100
* 593347 is not lucky: (5 + ((9 / (3 / 34)) - 7)) = 100
* 271353 is not lucky: (2 - (7 * (((1 / 3) - 5) * 3))) = 100
The combination has to evaluate to 100 exactly to be counted as unlucky. Fractions can occur in intermediate calculations (like in above examples for 593347 and 271353) but the result must be an integer.

Task:
Given a 6-digit number of the ticket, the program should determine whether it is mathematically lucky or not.

Input: 6 digits as a string.
Output: Is it mathematically lucky or not as a boolean.

How it is used:
This is a nice game to improve mind-calculation skills. If you have coder or math-geek friends, then you can give them this as a challenge. Who’s code will check digits faster than the others? After solving this task you will have the skills to cheat! ;-)

"数学的ラッキーチケット"のコンセプトは, ロシアの"ラッキーチケット"のアイデアと似ている. それは古い公共交通のチケットで, チケットには6桁の数字が印刷されていた.
あなたにはチケットの数字と, いくつかのルールに従ったそれぞれの桁を数式が与えられる.
1. 数字の桁は数字のグループとして分離することができる.
2. あなたは数字のグループの順序を変えることはできない.
3. それぞれのグループは1つの数字として扱かわれる(1と2からなるグループは12として扱う).
4. 演算記号(+, -, *, /)はグループの間におかれる.
5. 丸括弧は順序評価のあいまさをなくすために, 部分式の周りに置かれる.
たとえば,
* 238756 -> (2 * (38 + ((7 + 5) * 6)))
* 000859 -> (0 + (00 + (8 + (5 + 9))))
* 561403 -> (5 * (6 + (1 + (40 / 3))))
チケットの数字の桁の計算結果が100にならないものを, 数学的にラッキーとする. たとえば,
* 000000 は明らかにラッキーだ, 0はどういう組み合わせでも0だ,
* 707409 と 561709 は100になる組み合わせがないのでラッキーだ
* 595347 はラッキーではない: (5 + ((9 * 5) + (3 + 47))) = 100
* 593347 はラッキーではない: (5 + ((9 / (3 / 34)) - 7)) = 100
* 271353 はラッキーではない: (2 - (7 * (((1 / 3) - 5) * 3))) = 100
100と評価された組み合わせは確実にアンラッキーとしてカウントされる. 分数は計算の途中に発生する(593347や271353など)が, 結果は整数となる.

タスク
チケットの6桁の数字が与えられる, その数字が数学的ラッキーかどうかを判定するプログラムを作成せよ.

入力:6桁の数字を文字列として
出力:数学的ラッキーかどうかをbooleanで

備考
これは計算スキルと改良するよいゲームである. あなたにコーダーか, 数学オタクの友達がいるなら, 彼らに挑戦としてこの問題を教えよう. 誰よりも早くチェックできるコードを書くのは誰か? このタスクを解いたあとならあなたにはチートのためのスキルがある! ;-)

Periodic Table

Hacking the Periodic Table of Elements, because ‘why not’?
最終更新:2014年06月08日 02:20