CF834A.The Useless Toy
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述

Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption.
Spinners in Sweetland have the form of V-shaped pieces of caramel. Each spinner can, well, spin around an invisible magic axis. At a specific point in time, a spinner can take 4 positions shown below (each one rotated 90 degrees relative to the previous, with the fourth one followed by the first one):

After the spinner was spun, it starts its rotation, which is described by a following algorithm: the spinner maintains its position for a second then majestically switches to the next position in clockwise or counter-clockwise order, depending on the direction the spinner was spun in.
Slastyona managed to have spinner rotating for exactly n seconds. Being fascinated by elegance of the process, she completely forgot the direction the spinner was spun in! Lucky for her, she managed to recall the starting position, and wants to deduct the direction given the information she knows. Help her do this.

斯拉丝托娜在棉花糖城的街道上漫步时,发现一些商贩正在售卖一种如今非常流行的无用玩具——焦糖旋转器(caramel spinner)!为了跟上这股热潮,她立刻买下了这个奇特的装置。
甜味国度(Sweetland)中的旋转器呈 V 形焦糖状。每个旋转器可以围绕一根看不见的魔法轴进行旋转。在某一特定时刻,旋转器可处于如下四种位置之一(每种位置相对于前一种顺时针旋转 90 度,第四种位置之后又回到第一种位置):

旋转器启动后便开始旋转,其旋转过程遵循如下规则:旋转器在每一位置保持静止 1 秒,然后便庄严地切换至下一个位置——若初始旋转方向为顺时针,则按顺时针顺序切换;若为逆时针,则按逆时针顺序切换。
斯拉丝托娜成功让旋转器恰好旋转了 n 秒。她被这一过程的优雅深深吸引,以至于完全忘记了旋转器最初的旋转方向!幸运的是,她还记得旋转器的起始位置,并希望根据已知信息推断出初始旋转方向。请帮她完成这一推理。
输入格式
There are two characters in the first string – the starting and the ending position of a spinner. The position is encoded with one of the following characters: v (ASCII code 118, lowercase v), < (ASCII code 60), ^ (ASCII code 94) or > (ASCII code 62) (see the picture above for reference). Characters are separated by a single space.
In the second strings, a single number n is given (0 ≤ n ≤ 109) – the duration of the rotation.
It is guaranteed that the ending position of a spinner is a result of a n second spin in any of the directions, assuming the given starting position.
第一行字符串包含两个字符——分别表示旋转器的起始位置和结束位置。位置由以下字符之一编码:v(ASCII 码 118,小写字母 v)、<(ASCII 码 60)、^(ASCII 码 94)或 >(ASCII 码 62)(参见上方图片作为参考)。这两个字符之间用一个空格分隔。
第二行字符串中给出一个整数 $ n ( 0 \leq n \leq 10^9 $)——表示旋转持续时间(单位:秒)。
保证:在给定起始位置的前提下,沿任意方向旋转 $ n $ 秒后,旋转器的结束位置与输入中给出的结束位置一致。
输出格式
Output cw, if the direction is clockwise, ccw – if counter-clockwise, and undefined otherwise.
如果方向为顺时针,则输出 cw;如果为逆时针,则输出 ccw;否则输出 undefined。
输入输出样例
输入#1
^ > 1
输出#1
cw
输入#2
< ^ 3
输出#2
ccw
输入#3
^ v 6
输出#3
undefined
输入解题思路,AI测评打分。不知道怎么写?