CF834A.The Useless Toy

普及/提高-

通过率:0%

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 nn 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 118118 , lowercase v), < (ASCII code 6060 ), ^ (ASCII code 9494 ) or > (ASCII code 6262 ) (see the picture above for reference). Characters are separated by a single space.

In the second strings, a single number nn is given ( 0<=n<=1090<=n<=10^{9} ) – the duration of the rotation.

It is guaranteed that the ending position of a spinner is a result of a nn 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
    
首页