Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int arrLen, sumNumbers = 0, averageNum, oddSum = 0, evenSum = 0;
- cin >> arrLen;
- int* numbers = new int[arrLen];
- for (int i = 0; i < arrLen; i++) {
- cin >> numbers[i];
- sumNumbers += numbers[i];
- }
- averageNum = (double)sumNumbers / arrLen;
- for (int i = 0; i < arrLen; i++) {
- if (numbers[i] <= averageNum) {
- (i % 2 == 1 ? oddSum : evenSum) += numbers[i];
- }
- }
- cout << oddSum * evenSum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement