Untitled

mail@pastecode.io avatar
unknown
c_cpp
6 months ago
451 B
4
Indexable
Never
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int req_size;
    cin >> req_size;

    vector<int> requests(req_size);

    // Read all the requests.
    for (int i = 0; i < req_size; i++) {
        cin >> requests[i];
    }

    int memory_server1 = 0;
    for (int i = 0; i < req_size; i += 2) {
        memory_server1 += requests[i];
    }

    cout << memory_server1 << endl;

    return 0;
}