Newcoder 68 A.圆圆(水~)

Description

我们定义一个圆 C C C 为以原点 ( 0 , 0 ) (0, 0) (0,0) 为中心的单位圆(半径为 1 1 1 的圆)。给定在 C C C 圆周上相异的两点

A , B A, B A,B。请问由 A A A 出发,沿着圆周走到 B B B,是顺时针走比较近,还是逆时针走比较近呢?

$ C$ 的圆周上的所有点都可以用 ( c o s ( t ) , s i n ( t ) ) (cos(t), sin(t)) (cos(t),sin(t)) 来表示,其中 t t t 的物理意义为角度。也就是说,在圆 C 中,给定一角度$ t$ 即可确定在圆周上的一点。在这题中,所有的角度皆以弧度制表示,另外,由于不同的 t t t 值有机会对应到同一个圆周上的点,我们限制 t t t 的范围为 [ − π , π ) [-π,π ) [π,π)

本题中,我们会用 t A t_A tA 以及 t B t_B tB 来代表点 A A A 及点 B B B,数学上, A = ( c o s ( t A ) , s i n ( t A ) ) , B = ( c o s ( t B ) , s i n ( t B ) ) A = (cos(t_A), sin(t_A)), B = (cos( t_B), sin(t_B)) A=(cos(tA),sin(tA)),B=(cos(tB),sin(tB))

Input

输入的第一行有一个正整数 T T T,代表接下来共有几组测试数据。

接下来的 T T T行,每行有两个浮点数 t A , t B t_A, t_B tA,tB,代表一组数据。

( 1 ≤ T ≤ 1 0 5 , − π ≤ t A , t B < π , A ≠ B ) (1\le T\le 10^5,-\pi\le t_A,t_B<\pi,A\neq B) (1T105,πtA,tB<π,A̸=B)

Output

对于每组数据请输出一行,如顺时针比较近请输出 “ c l o c k w i s e ” “clockwise” clockwise,否则请输出 “ c o u n t e r c l o c k w i s e ” “counterclockwise” counterclockwise

Sample Input

3
3.14 3.13
-3.14 -3.13
1.00 2.00

Sample Output

clockwise
counterclockwise
counterclockwise

Solution

简单题,稍微判断一下即可

Code

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
typedef long long ll;
typedef pairP;
const int INF=0x3f3f3f3f,maxn=100001;
const double pi=acos(-1.0);
int main()
{
	int T;
	double a,b;
	scanf("%d",&T);
	while(T--)
	{
		scanf("%lf%lf",&a,&b);
		if(api)printf("clockwise\n");
			else printf("counterclockwise\n");
		}
		else
		{
			if(a-b>pi)printf("counterclockwise\n");
			else printf("clockwise\n");
		}
	}
	return 0;
}

你可能感兴趣的:(Newcoder,水题)