提交时间:2025-07-25 16:58:48

运行 ID: 336133

#include<iostream> using namespace std; int main(){ int n,x,t,c; while(cin>>n,n){ c=0; t=0; while(n--){ cin>>x; t+=5; if(x>c) t+=(x-c)*6; else t+=(c-x)*4; c=x; } cout<<t<<endl; } return 0; }