Non-interger Area
作者:互联网
#include <iostream>
#include <cmath>
#include<vector>
using namespace std;
typedef long long ll;
const int N = 1e5 + 10;
ll cnt[2][2];
int n;
void solve() {
cin >> n;
for (int i =1; i<= n; i ++) {
ll x, y ;
cin >> x >> y;
cnt[(x%2 + 2) % 2][(y % 2 + 2) % 2] ++;
}
ll ans = 0;
for (int i = 0; i < 2; i ++) {
for (int j = 0; j < 2; j ++) {
for (int k = 0; k < 2; k ++) {
for (int x = 0; x < 2; x ++) {
for (int y = 0; y < 2; y ++) {
for (int z = 0 ; z < 2; z ++) {
int u = -(y - i) * (x - j) + (k - i) * (z - j);
if ((u % 2 + 2) % 2 == 1) {
ans += cnt[i][j] * cnt[k][x] * (cnt[y][z]);
}
}
}
}
}
}
}
cout << ans /6 << endl;
}
int main () {
int T;
T = 1;
while (T --) {
solve();
}
return 0;
}
反思:在哪里卡住了,根本不需要判断是否为三角形,因为直接选点, 算面积的方法;叉积以及海伦公式,这题用叉积
标签:Non,Area,int,ll,interger,cnt,++,ans,include 来源: https://blog.csdn.net/qq_28409093/article/details/122612214