http://icpc.upc.edu.cn/problem.php?cid=1406&pid=6
f[用法力][层数]=min(f[不用法力?][层数-1],f[不用法力][层数-2])
f[不用法力][层数]=min(f[用法力][层数-1],f[不用法力][层数-1])
#include<cstdio>
#include<iostream>
using namespace std;
int a[100000],n,i,f[3][1000000];
int main() {
scanf("%d",&n);
for (i=1; i<=n; i++) {
scanf("%d",&a[i]);
}
for (i=1; i<=n; i++) {
f[1][i]=min(f[2][i-1],f[1][i-1])+a[i];
f[2][i]=min(f[1][i-1],f[1][i-2]);
}
printf("%d\n",min(f[1][n],f[2][n]));
}