QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21277. Chỉ dẫn sai

Statistics

Farmer John vừa mua máy kéo mới sang trọng có thể lập trình. Ông nhập chuỗi dài $N$, $1 \le N \le 100,000$, chỉ gồm F, $L$, $R$. F tiến một đơn vị, $L$ và $R$ lần lượt quay trái và phải $90^\circ$. Máy bắt đầu ở gốc $(0,0)$ hướng bắc.

Sau khi nhập chuỗi dự định, FJ nhớ đã gõ sai đúng một ký tự nhưng không nhớ đâu! Ví dụ F hoặc $L$ thay cho $R$. Đếm các vị trí cuối khác nhau có thể trong mặt phẳng (hướng cuối không quan trọng).

Dữ liệu vào

  • Dòng 1: chuỗi lệnh dự định của Farmer John.

Dữ liệu ra

  • Dòng 1: số vị trí cuối có thể khi gõ sai một ký tự.

Ví dụ

Dữ liệu vào 1

FF

Dữ liệu ra 1

3

Ghi chú

Farmer John muốn tiến hai lần, lý tưởng đến $(0,2)$.

Bốn chuỗi sai là FL, FR, LF, RF, lần lượt đến $(0,1)$, $(0,1)$, $(-1,0)$, $(1,0)$: ba vị trí khác nhau.

Tác giả bài toán: Brian Dean, 2012

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.