Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define x first
- #define y second
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- pair<int,int> p[4];
- for (int i=0;i<4;i++){
- cin >> p[i].x;
- cin >> p[i].y;
- }
- int a = (p[0].x - p[3].x) * (p[1].y - p[0].y) - (p[1].x-p[0].x) *(p[0].y - p[3].y);
- int b = (p[1].x - p[3].x) * (p[2].y - p[1].y) - (p[2].x-p[1].x) *(p[1].y - p[3].y);
- int c = (p[2].x - p[3].x) * (p[0].y - p[2].y) - (p[0].x-p[2].x) *(p[2].y - p[3].y);
- if ((a<=0 && b<=0 && c<=0)||(a>=0 && b>=0 && c>=0)){
- cout << "In";
- }else{
- cout << "Out";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement