mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-27 16:56:26 +00:00
P6102 [EER2]谔运算
R54857077
This commit is contained in:
parent
59b7cf75f3
commit
aa714607b4
28
Luogu/problem/P6102/P6102.cpp
Normal file
28
Luogu/problem/P6102/P6102.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int n, x, y, xs, ys, sum;
|
||||
unsigned int ans, a[500005];
|
||||
|
||||
int main() {
|
||||
cin >> n;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
sum = n * n;
|
||||
for (int i = 0; i < 32; i++) {
|
||||
x = y = xs = ys = 0;
|
||||
for (int j = 1; j <= n; j++) {
|
||||
if ((a[j] >> i) & 1) xs++;
|
||||
}
|
||||
ys = n - xs;
|
||||
for (int j = 1; j <= n; j++) {
|
||||
x = xs * n + ys * xs;
|
||||
y = ys * n + xs * ys;
|
||||
}
|
||||
ans += (x * y + (sum - x) * (sum - y)) << i;
|
||||
}
|
||||
cout << ans << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user