CSP-202109-1-数组推导
解题代码
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long maxSum, minSum;
int main() {
int n;
cin >> n;
vector<int>B(n);
for (auto& it : B)
{
cin >> it;
maxSum += it;
}
auto last = unique(B.begin(), B.end());
B.erase(last, B.end());
for (auto& it : B) {
minSum += it;
}
cout << maxSum << endl << minSum;
return 0;
}