当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1660:Princess FroG

题目描述
Long, long ago there was a monster lived in Adventure Castle of Magic. One day he saw that the prince Infante Concord and his wife Princess Charm were living so sweet a life. Couldn't help becoming jealous, he used his powerful magic to turn the prince to an ugly frog. The brave and smart princess made up her mind to rescue her husband. After overcomed thousands of difficulties and challenges, she finally arrived at the Adventure Castle of Magic. When she saw her dearest handsome husband had become an ugly and awful frog by the curse of the monster, her heart almost broken. The monster gave her a very hard puzzle as a condition to exchange the prince. The princess was required to choose the right ones from some given ropes. A right rope means that the rope wouldn't make a knot by pulling up its two ends. If the princess chose all the right ones, the curse would disappear and the price would be rescued, otherwise he would be strangled to death. In order to rescue her husband, without hesitation, the princess accepted the challenge.

Here are two example ropes. Figure_1 is a right rope while Figure_2 is not a right rope:

Figure_1

输入解释
The first line of the input is an integer t (1 <= t <= 20), representing the number of ropes. Each of the following lines describes a rope.

We describe the rope by pointing out the cross-point (See Figure_2). We first number all the cross-point. Then, our fingers go along the rope from one end to the other, whenever we encounter a cross-point we will record its number on the paper. If the rope goes above the point, we write down a positive number. If the rope goes under the point, we write down a negative number. In the end, we put a zero as an end sign. For example, the rope shown in Figure_2 is recorded as:

+1 -2 +3 -4 +5 -6 -7 +8 +2 -1 -10 +9 -8 -3 +4 -5 +6 +7 -9 +10 0

Figure_2

输出解释
For each rope, output one line. If the rope will make a knot by pulling up its ends, output "Not right". Otherwise, output "Right".
输入样例
3
+1 -1 0
-1 -2 -3 +1 +2 +3 0
+1 -2 +3 -4 +5 -6 -7 +8 +2 -1 -10 +9 -8 -3 +4 -5 +6 +7 -9 +10 0
输出样例
Right
Right
Not right

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-1660

最后修改于 2020-10-29T06:10:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536