mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 15:58:47 +00:00
parent
f36ed8c800
commit
9ce4eac729
36
S2OJ/1487/1487.cpp
Normal file
36
S2OJ/1487/1487.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
|
||||
int n, a[N];
|
||||
long long lst, sum, ans;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n);
|
||||
|
||||
for (int i = 0; i <= n; i++) {
|
||||
sum += a[i];
|
||||
while (a[i] == a[i + 1]) sum += a[++i];
|
||||
ans += sum - std::max(lst, (static_cast<long long>(a[i]) + 1 >> 1) - 1);
|
||||
lst = sum;
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1487/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1487/data/sum9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1487/data/sum9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user