Lang:G++
Edit123456789101112131415161718192021222324252627#include <algorithm>#include <iostream>#include <string>#include <vector>using namespace std;int Area2(long x0, long y0, long x1, long y1, long x2, long y2) {auto ret = x0 * (y1 - y2) - y0 * (x1 - x2) + x1 * y2 - x2 * y1;return ret < 0 ? -ret : ret;}int main() {int t;cin >> t;while (t-- > 0) {int px, py, ax, ay, bx, by, cx, cy;cin >> px >> py >> ax >> ay >> bx >> by >> cx >> cy;auto eq = Area2(ax, ay, bx, by, cx, cy) ==Area2(ax, ay, bx, by, px, py) +Area2(ax, ay, px, py, cx, cy) +Area2(px, py, bx, by, cx, cy);cout << (eq ? "YES" : "NO") << endl;}return 0;}