PATA -1008 Elevator
#include<stdio.h> using namespace std; int main(){ int n; scanf("%d",&n); int b,nowb,subb,res=0; b=0; for(int i=0;i<n;i++){ scanf("%d",&nowb); subb = nowb - b; if(subb>0) res += subb*6 + 5; else res += (-subb)* 4 + 5; b = nowb; } printf("%d",res); return 0; }