【杭电多校2020】第八场1003.Clockwise or Counterclockwise

孟哲
2023-12-01

题目链接

思路:

如果输出结果是顺时针则叉积方向向内,当结果是逆时针时叉积方向向外。

代码:

#include<bits/stdc++.h>
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const int N=2e6+7;
const int M=2e4+5;
const double eps=1e-8;
const int mod=998244353;
const int inf=0x7fffffff;
const double pi=3.1415926;
using namespace std;
signed main()
{
    IOS;
    int t;
    cin>>t;
    while(t--)
    {
        int x1,x2,x3,y1,y2,y3;
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        if((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)<0)
        {
            cout<<"Clockwise"<<endl;
        }
        else
        {
            cout<<"Counterclockwise"<<endl;
        }
    }
    return 0;
}

 类似资料: