3782. 点
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
ll ansx1, ansx2, ansy1, ansy2;
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
int x, y;
scanf("%d%d", &x, &y);
ansx1 += x * x, ansx2 += x;
ansy1 += y * y, ansy2 += y;
}
cout << (n * ansx1 - ansx2 * ansx2) + (n * ansy1 - ansy2 * ansy2) << endl;
return 0;
}
题解: