백준
[11758번] ccw
2744m
2019. 8. 13. 20:29
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 |