Topic ensure the three points are not collinear, that can be any three points form a triangle
I did not know how to think, but also think of the judgment is not a triangle, it may be a question of reason, usually I do not think this question is no hope
Suppose there are five points ABCDE
You can have a triangular configuration
ABC ABD ABE
ACD ACE
ADE
BCD BCE
BDE
CDE
All triangular perimeter and
Into each side
For example, AB appeared three times in all triangles
AC is three times
The other side is three times
If there are n number of times each edge appears that n - 2 times
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e3 + 5; const int mod = 998244353; int n; int ans; pair<int,int> p[maxn]; int dist(pair<int,int> a,pair<int,int> b){ return abs(a.first - b.first) + abs(a.second - b.second); } signed main() { //freopen("in", "r", stdin); ios::sync_with_stdio(); cin >> n; for (int i = 1; i <= n; i++) cin >> p[i].first >> p[i].second; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) ans = (ans + dist(p[i],p[j]) * (n - 2)) % mod; } cout << ans; return 0; }