[백준] 11758 CCW

0

백준

목록 보기
5/271
post-thumbnail

백준 11758 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;
}
profile
Be able to be vulnerable, in search of truth

0개의 댓글