304363: CF834A. The Useless Toy
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
The Useless Toy
题意翻译
题目描述 走在马什马洛市的街道上,斯拉斯蒂诺纳看到一些商人在卖一种现在很流行的无用玩具——焦糖纺纱机!她想加入热潮,于是便买了一个。 斯威特兰的纺纱工有V形焦糖的形状。每个纺纱机都可以绕着一条看不见的魔法轴旋转。在特定的时间点,旋转器可以采取如下所示的4个位置(每个位置相对于前一个旋转90度,第四个位置后面跟着第一个位置): ![](https://cdn.luogu.org/upload/vjudge_pic/CF834A/978c2c171211f16d263ee860d565ee38c2afcc26.png) 在纺纱机被纺纱后,它开始旋转,这通过以下算法描述:纺纱机维持其位置一秒钟,然后以顺时针或逆时针的顺序庄严地切换到下一个位置,这取决于纺纱机的纺纱方向。 斯拉斯蒂诺纳设法使旋转器旋转了n秒。被过程的优雅所吸引,她完全忘记了纺纱机旋转的方向!幸运的是,她成功地回忆起了开始的位置,并想根据她所知道的信息推断出方向。请你帮助她完成这件事。 输入输出格式 输入格式: 第一个字符串中有两个字符——旋转器的起始位置和结束位置。该位置用下列字符之一编码:v(ASCII代码118,小写字母v)、<(ASCII代码60)、^(ASCII代码94)或>(ASCII代码6262)(参见上面的图片以供参考)。字符由一个单独的空间分隔。 在第二个字符串中,输入单个数n( 0<=n<=10^9)——旋转的持续时间。 在假定给定起始位置的情况下,保证旋转器的结束位置是任意方向上n次旋转两次的结果。 输出格式: 如果方向是顺时针,输出cw。如果逆时针,否则未定义。题目描述
![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF834A/d5049440115832cb73999e95c7f23013e57b7297.png)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): ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF834A/978c2c171211f16d263ee860d565ee38c2afcc26.png)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.输入输出格式
输入格式
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<=10^{9} $ ) – 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.
输出格式
Output cw, if the direction is clockwise, ccw – if counter-clockwise, and undefined otherwise.
输入输出样例
输入样例 #1
^ >
1
输出样例 #1
cw
输入样例 #2
< ^
3
输出样例 #2
ccw
输入样例 #3
^ v
6
输出样例 #3
undefined