mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-23 18:48:48 +00:00
parent
1e7407922a
commit
096df42bd6
32
Luogu/P2345/P2345.cpp
Normal file
32
Luogu/P2345/P2345.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 5e4 + 5;
|
||||
|
||||
int n;
|
||||
long long ans;
|
||||
std::pair<int, int> p[N];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
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 = 1; j < i; j++) {
|
||||
ans += 1ll * std::max(p[i].first, p[j].first) * std::abs(p[i].second - p[j].second);
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user