1098: 贪吃蛇
Memory Limit:32 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:9
Solved:3
Description
不允许普通用户打印题目,请教师登录后使用。如有疑问请联系管理员!
Input
测试数据有多组。
每组的第一行输入一个整数n(n<100),表示要走n步。当n=0时,输入结束。
第二行输入一个包含n个字符的字符串表示每次的移动方向。Output
对于每组样例输出一行,格式为以下三种之一:
The worm ran into itself on move m.
The worm ran off the board on move m.
The worm successfully made all m moves.
m的大小由你的程序决定,我们规定第一次移动为move 1,详情参见样例。Sample Input Copy
18
NWWWWWWWWWWSESSSWS
20
SSSWWNENNNNNWWWWSSSS
30
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
13
SWWWWWWWWWNEE
0
Sample Output Copy
The worm successfully made all 18 moves.
The worm ran into itself on move 9.
The worm ran off the board on move 21.
The worm successfully made all 13 moves.