Swust oj 1139: Coin-row problem

#include <iostream>
#include <algorithm>
#include <string.h>         //for memset

//原始数据数组
int form[10001];
int x[10001];

int main()
{
    //原始数据和初始化
    int n;
    memset(form, 0, sizeof(form));
    memset(x, 0, sizeof(x));

    //输入
    std::cin >> n;
    for (int i(1); i <= n; ++i)
    {
        std::cin >> x[i];
    }

    form[1] = x[1];
    for (int i(2); i <= n; ++i)
    {
        form[i] = std::max(form[i - 1], form[i - 2] + x[i]);
    }
   
    std::cout << form[n] << std::endl;

    return 0;
}