简析:10分钟内ac,没有难度。
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
int n, f0 = 0, f1, sum = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n; i++) {
f1 = a[i];
if (f1 - f0 > 0) {
sum += (f1 - f0) * 6;
}else{
sum += (f1 - f0) * -4;
}
f0 = f1;
}
sum += n * 5;
cout << sum << endl;
return 0;
}