059 判断一个点是否在三角形内部
Table of Contents

ac

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static Scanner sc = new Scanner(System.in);

    static int M = (int) Math.pow(10, 9) + 7;

    public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    // 叉积
    static double crossProduct(double x1,double y1,double x2,double y2){
        return x1*y2-x2*y1;
    }

    static boolean isInside(double x1,double y1,double x2,double y2,double x3,double y3,double x,double y){
        if(crossProduct(x1-x2,y1-y2,x1-x3,y1-y3)>=0){
            double tmpx = x2;
            double tmpy = y2;
            x2 = x3;
            y2 = y3;
            x3 = tmpx;
            y3 = tmpy;
        }
        if(crossProduct(x1-x2,y1-y2,x1-x,y1-y)>0){
            return false;
        }
        if(crossProduct(x2-x3,y2-y3,x2-x,y2-y)>0){
            return false;
        }
        if(crossProduct(x3-x1,y3-y1,x3-x,y3-y)>0){
            return false;
        }
        return true;
    }

    public static void main(String[] args)throws Exception{
        String[] tmp = reader.readLine().split(" ");
        double x1 = Double.valueOf(tmp[0]);
        double y1 = Double.valueOf(tmp[1]);
        tmp = reader.readLine().split(" ");
        double x2=Double.valueOf(tmp[0]);
        double y2=Double.valueOf(tmp[1]);
        tmp = reader.readLine().split(" ");
        double x3=Double.valueOf(tmp[0]);
        double y3=Double.valueOf(tmp[1]);
        tmp = reader.readLine().split(" ");
        double x = Double.valueOf(tmp[0]);
        double y = Double.valueOf(tmp[1]);
        System.out.println(isInside(x1,y1,x2,y2,x3,y3,x,y) ? "Yes" : "No");
    }

}