QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 512 MB 満点: 100

#3779. 快乐机器人

統計

一个机器人正根据指令序列从 $(0,0)$ 出发进行移动。序列中的每个字符代表一条指令:

  • L:向左转
  • R:向右转
  • F:向前走一步

有趣的是,指令序列中包含一些通配符字符 "?"。机器人可以根据自己的意愿将其视为 L、R 或 F 中的任意一个,这让它感到非常快乐。

设 $(x,y)$ 为机器人的最终位置,你的任务是找出 $x$ 和 $y$ 的最小值与最大值。机器人初始时面向东方(即在笛卡尔坐标系中面向 $(1,0)$)。向左转后,它将面向北方(即面向 $(0,1)$)。

输入格式

最多有 1000 组测试数据。每组数据包含一个长度不超过 1000 个字符的指令序列。

输出格式

对于每组测试数据,输出样例编号,随后依次输出 $x$ 的最小值、最大值,以及 $y$ 的最小值、最大值。

样例

输入格式 1

F?F
L??
LFFFRF

输出格式 1

Case 1: 1 3 -1 1
Case 2: -1 1 0 2
Case 3: 1 1 3 3

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.