CCW 알고리즘 이용하여 풀이
#include <iostream>
#include <math.h>
#include <utility>
using namespace std;
int ccw(pair<int,int> a, pair<int, int> b) {
int cross = a.first * b.second - a.second * b.first;
if (cross > 0) return 1;
else if (cross < 0) return -1;
else return 0;
}
int ccw(pair<int, int> p, pair<int, int> a, pair<int, int> b) {
a.first -= p.first; a.second -= p.second;
b.first -= p.first; b.second -= p.second;
return ccw(a,b);
}
int main() {
int x, y;
cin >> x >> y;
pair<int, int> P1 = make_pair(x, y);
cin >> x >> y;
pair<int, int> P2 = make_pair(x, y);
cin >> x >> y;
pair<int, int> P3 = make_pair(x, y);
cout<< ccw(P1, P2, P3);
return 0;
}