Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- struct vect {
- int x, y;
- void read() {
- cin >> x >> y;
- }
- vect() {}
- vect(int a, int b) {
- x = a, y = b;
- }
- };
- vect operator - (vect a, vect b) {
- return vect(a.x - b.x, a.y - b.y);
- }
- int operator * (vect a, vect b) {
- return a.x * b.y - a.y * b.x;
- }
- vect v[5];
- int main() {
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int n, res = 0, sum, s;
- cin >> n;
- for (int i = 0; i < n; i++) {
- sum = s = 0;
- vect p;
- p.read();
- for (int j = 0; j < 4; j++)
- v[j].read();
- v[4] = v[0];
- for (int j = 0; j < 4; j++)
- sum += abs((v[j] - p) * (v[j + 1] - p));
- p = v[0];
- for (int j = 0; j < 4; j++)
- s += abs((v[j] - p) * (v[j + 1] - p));
- if (s == sum) res++;
- }
- cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement