提交时间:2025-07-25 16:59:01
运行 ID: 336134
#include<iostream> using namespace std; int main(){ int n,x,t,c; while(cin>>n,n){ c=0; t=0; for(int i=1;i<=n;i++){ cin>>x; t+=5; if(x>c) t+=(x-c)*6; else t+=(c-x)*4; c=x; } cout<<t<<endl; } return 0; }