[BOJ] 11758 CCW

Time Lapse :NONE

11758.cpp

1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <algorithm>
using namespace std;
int ccw(pair<int, int> a, pair<int, int> b, pair<int, int> c) {
int op = a.first * b.second + b.first * c.second + c.first * a.second - (a.second * b.first + b.second * c.first + c.second * a.first);
return op > 0 ? 1 : !op ? 0 : -1;
}
int main() {
pair<int, int> a, b, c;
scanf("%d %d %d %d %d %d",&a.first, &a.second, &b.first, &b.second, &c.first, &c.second);
printf("%d",ccw(a,b,c));
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/09/03/PS/BOJ/11758/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.