链接:http://codeforces.com/contest/834/problem/A
Solution:
很简单的整除判断
因为太久没有写过代码怕出问题,写得非常累赘(暴力)
#include<stdio.h>
int ch(char a)
{
if (a=='^') return 1;
if (a=='>') return 2;
if (a=='v') return 3;
if (a=='<') return 4;
}
int main()
{
char a,b;
int n,r1,r2,i,j,tms;
bool cw,ccw;
scanf("%c %c",&a,&b);
scanf("%d",&n);
r1=ch(a);r2=ch(b);
i=r1,j=r2;
tms=0;
while (i!=j)
{
tms++;
if (i++==4) i=1;
}
cw=(tms<=n) && (((n-tms)&3)==0);
i=r1,j=r2;
tms=0;
while (i!=j)
{
tms++;
if (i--==1) i=4;
}
ccw=(tms<=n) && (((n-tms)&3)==0);
if (cw^ccw) puts(cw?"cw":"ccw") ;
else puts("undefined");
}