AtCoder Beginner Contest 082
翻译中…
Problem Statement
翻译中…
A robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in the positive $x$-axis direction.
翻译中…
This robot will be given an instruction sequence $s$. $s$ consists of the following two kinds of letters, and will be executed in order from front to back.
翻译中…
F: Move in the current direction by distance$1$.T: Turn$90$degrees, either clockwise or counterclockwise.
翻译中…
The objective of the robot is to be at coordinates $(x, y)$ after all the instructions are executed. Determine whether this objective is achievable.
翻译中…
Constraints
翻译中…
$s$consists ofFandT.$1 \leq |s| \leq 8$$000$$x$and$y$are integers.$|x|, |y| \leq |s|$
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
s
x y
翻译中…
Output
翻译中…
If the objective is achievable, print Yes; if it is not, print No.
翻译中…
样例
Input #1
FTFFTFFF
4 2
Output #1
Yes
The objective can be achieved by, for example, turning counterclockwise in the first `T` and turning clockwise in the second `T`.
Input #2
FTFFTFFF
-2 -2
Output #2
Yes
The objective can be achieved by, for example, turning clockwise in the first `T` and turning clockwise in the second `T`.
Input #3
FF
1 0
Output #3
No
Input #4
TF
1 0
Output #4
No
Input #5
FFTTFF
0 0
Output #5
Yes
The objective can be achieved by, for example, turning counterclockwise in the first `T` and turning counterclockwise in the second `T`.
Input #6
TTTT
1 0
Output #6
No
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。