Solution to the problem number UCV2013J of Spoj - UCV2013J.

Any questions do not hesitate to contact.

#include<bits/stdc++.h>
using namespace std;
int main() {
    int cases;
    while(scanf("%d",&cases)&&cases!=0)
    {
    int total,res=0;
    for(int i=0; i<cases;i++)
    {
        cin>>total;
        if((cases/2)<=i)
        res+=total;
    }
    cout<<res<<endl;
    }
    return 0;
}
 

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!