fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n, a[100005];
  6.  
  7.  
  8. int main() {
  9. cin >> n;
  10. for (int i = 0; i <= n - 1; i++)
  11. cin >> a[i];
  12. long long Ans = 0;
  13. for (int i = 0; i <= n - 1; i++)
  14. if (i % 2 == 1)
  15. Ans += a[i];
  16.  
  17. cout << Ans;
  18.  
  19. }
  20.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
Standard output is empty