ACM Commands
来源:互联网 发布:opencv区域生长算法 编辑:程序博客网 时间:2024/06/15 07:01
Commands
Time Limit:1000MS Memory Limit:65536K
Total Submit:51 Accepted:14
Description
You are standing on some arbitrary point in the infinite plane.
You are given some string commands that contains the commands you have to execute. Each character of each element of commands is one command. The commands must be executed in the given order: first you execute all commands in the first element of commands one by one, then those in the second element, etc.
There are only three types of commands: 'S' means "step forward", 'L' means "turn 90 degrees to the left", and 'R' means "turn 90 degrees to the right". All your steps have the same length.
You will be executing the commands forever: after you execute the last character of the last element of commands, you will always start from the beginning again.
We say that your path is bounded if there is some positive real number R such that while executing the infinite sequence of steps you will never leave the circle with radius R steps and center at your starting location.
You should determine whether your path will be bounded or not. Return the string "bounded" (quotes for clarity) if the path is bounded and "unbounded" if it is not.
Input:
The first line is a number n,means there are n commands;
And then n lines,every line is a string consist of 'S','R','L',means n commands;
Output:
Output one line "bounded" if there is some positive real number R such that while executing the infinite sequence of steps you will never leave the circle with radius R steps and center at your starting location.
else output one line "unbounded";
Constraints
-
commands will contain between 1 and 50 elements, inclusive.
-
Each element in commands will contain between 1 and 50 characters, inclusive.
-
Each character in each element of commands will be one of 'S', 'L', and 'R'.
Input
The first line is a number n,means there are n commands;
And then n lines,every line is a string consist of 'S','R','L',means n commands;
Output
Output one line "bounded" if there is some positive real number R such that while executing the infinite sequence of steps you will never leave the circle with radius R steps and center at your starting location.
else output one line "unbounded";
Sample Input
1L1SRSL2SSSSR4SRSLLLSSSSSSLSSSSSSL
Sample Output
boundedunboundedboundedunbounded
Source
TopCoder
- ACM Commands
- commands
- Commands
- commands
- Linux Commands
- Solaris commands
- Oracle Commands
- gdb commands
- CVS Commands
- router commands
- DB2 Commands
- Linux Commands
- VxWorks Commands
- 重要 Commands
- SQL Commands
- Vista Commands
- ftp commands
- MySQL Commands
- 2010.7.14
- JavaBean组件和Serialization
- 搜索引擎蜘蛛隐身三法
- 语义Web概述
- 最熟悉的陌路人
- ACM Commands
- java类文件获取页面的request,session.response
- jquery.validate remote 和 自定义验证方法
- UNIX 编程实践教程学习笔记 (二)
- C++程序性能1
- 利用vector分配动态内存
- [翻]OOSE第3章:面向对象知识入门3.1
- RIM微软效仿苹果 将提供免费MobileMe同类服务
- Wicket on myEclipse