Click Here to go back to the homepage.

Jabuke Solution:


#include <bits/stdc++.h>
using namespace std;

double area(pair<double, double> a, pair<double, double>  b, pair<double, double> c){
    return abs(a.first * (b.second - c.second) + b.first * (c.second - a.second) + c.first * (a.second - b.second)) / 2;
}

int main(){
    // #ifndef TESTING
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    pair<double, double> a, b, c;
    cin >> a.first >> a.second
    >> b.first >> b.second
    >> c.first >> c.second;
    int trees, inside = 0;
    cin >> trees;
    double landArea = area(a, b, c);
    cout << fixed << setprecision(1) << landArea << endl;
    while(trees--){
        pair<double, double> tree;
        cin >> tree.first >> tree.second;
        if(abs(landArea - area(a, b, tree) - area(a, c, tree) - area(b, c, tree)) < 0.1){
            inside++;
        }
    }
    cout << inside << endl;
    return 0;   
}