题目的意思是给出两个方向和步骤,然后判是怎么判的
思路:先用map存一下4个方向,然后分别判顺逆时针能否达到
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <vector>
#include <bitset>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
#define mod 10000007
#define mem(a,b) memset(a,b,sizeof a)
map<char,int>mp;
int main()
{
mp['^']=0;
mp['>']=1;
mp['v']=2;
mp['<']=3;
char a,b;
int n;
while(cin>>a>>b)
{
cin>>n;
n%=4;
int x1=mp[a]+n;
if(x1>3)x1-=4;
int x2=mp[a]-n;
if(x2<0)x2+=4;
if(x1==mp[b]&&x2!=mp[b])
printf("cw\n");
else if(x1!=mp[b]&&x2==mp[b])
printf("ccw\n");
else
printf("undefined\n");
}
return 0;
}