如题。。。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string.h>
using namespace std;
//太水了好吧。。。
int n;
int timeup=;
int timedown=;
int main()
{
scanf("%d",&n);
int last=;
int now;
int sum=;
for(int i=;i<n;i++){
scanf("%d",&now);
sum+=((now-last)>=)?(now-last)*timeup:(last-now)*timedown;
last=now;
}
printf("%d",sum+n*);
return ;
}