1 人解决,2 人已尝试。
2 份提交通过,共有 4 份提交。
9.6 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
On an infinite chequered board there is a superknight which can make different moves. Each kind of move is described by two integers: the first tells how many columns (to the right if the number is positive or to the left if the number is negative) and the second tells how many rows (forward if the number is positive or backward if the number is negative) the knight traverses making such a move.
Task
Write a program which:
1.reads sets of data describing different superknights,
determines for each superknight whether it is able to reach any square of the board 2.making allowed moves,
3.writes the result.
In the first line there is one integer k denoting the number of sets of data, 1<=k<=100. It is followed by k sets of data. In the first line of each set there is an integer n being the number of kinds of the superknight’s moves, 1<=n<=100. Each of the following n lines of the set contains two integers p and q separated by a single space, -100<=p,q<=100. These numbers describe one kind of move.
The out should consist of k lines. The i-th line should contain one word TAK (“yes”), if the superknight described by the i-th set of data is able to reach any square of the board, or the word NIE (“no”) otherwise.
2 3 1 0 0 1 -2 -1 5 3 4 -3 -6 2 -2 5 6 -1 4
TAK NIE
1 人解决,2 人已尝试。
2 份提交通过,共有 4 份提交。
9.6 EMB 奖励。