Advertisement
evgenko

Untitled

Mar 7th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define x first
  3. #define y second
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     ios_base::sync_with_stdio(false);
  9.     cin.tie(NULL);
  10.     pair<int,int> p[4];
  11.     for (int i=0;i<4;i++){
  12.         cin >> p[i].x;
  13.         cin >> p[i].y;
  14.     }
  15.     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);
  16.     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);
  17.     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);
  18.     if ((a<=0 && b<=0 && c<=0)||(a>=0 && b>=0 && c>=0)){
  19.         cout << "In";
  20.     }else{
  21.         cout << "Out";
  22.     }
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement