1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <iostream> using namespace std; int ccw(pair<int,int>a, pair<int, int>b,pair<int, int>c) { int tmp1 = a.first*b.second + b.first*c.second + c.first*a.second; int tmp2 = a.second*b.first + b.second*c.first + c.second*a.first; int ans = tmp1 - tmp2; if (ans < 0)return -1; else if (ans == 0)return 0; else return 1; } int main() { ios::sync_with_stdio(0), cin.tie(0); pair<int, int> tmp[3]; for (int i = 0; i < 3; i++) { int x, y; cin >> x >> y; tmp[i] = { x,y }; } cout << ccw(tmp[0], tmp[1], tmp[2]); return 0; } | cs |
'백준' 카테고리의 다른 글
[1922번] 네트워크 연결 (0) | 2019.08.15 |
---|---|
[1708번] 볼록 껍질(Convex Hull) (0) | 2019.08.13 |
[2133번] 타일 채우기 (0) | 2019.06.11 |
[2206번] 벽 부수고 이동하기 (0) | 2019.05.27 |
[2609번] 최대 공약수와 최대 공배수 (0) | 2019.04.17 |
댓글