Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Super Knight
Description A super knight moves in the infinite x_{1}, x_{2}, …, x) to the square (_{n}x_{1} + a_{1}, x_{2} + a_{2}, …, x + _{n}a) or (_{n}x_{1} − a_{1}, x_{2} − a_{2}, …, x − _{n}a) is possible. Each knight has a prescribed set of such vectors, describing the moves this knight can make. For each knight we assume that this knight can reach anywhere in the space if it is allowed (but actually disallowed) to move along a fractional part of a vector._{n}We say two knights are equivalent, if they can reach exactly the same squares starting from the square (0, 0, …, 0) (by making many moves, perhaps). (Let us point out that equivalent knights may reach these squares in different number of moves). It can be shown that for every knight there exists an equivalent one whose moves are described by only Given a set of Input The input contains exactly one test case. The first line of input contains two integers i (1 ≤ i ≤ n) if n = 2, |a| ≤ 10_{i}^{3}, otherwise |a| ≤ 10_{i}^{2}.Output Output Sample Input 3 2 1 0 0 5 0 7 Sample Output 1 0 0 1 Hint Do not output any number longer than 50 digits. The test cases are designed that to each one there is a solution not involving any number exceeding 10 Source POJ Monthly--2007.06.03, Lei, Tao |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator