cjweffort

博客园 首页 联系 订阅 管理
// 1008. Elevator.cpp: 主项目文件。

#include "stdafx.h"
#include <cstdio>

int main()
{
    int n;
	scanf("%d",&n);
	int sum=sum=5*n,pre=0;
	for(int i=0;i<n;i++){
		int temp;
		scanf("%d",&temp);
		if(temp>pre)
			sum+=6*(temp-pre);
		else
			sum+=4*(pre-temp);
		pre=temp;
	}
	printf("%d\n",sum);
    return 0;
}


posted on 2013-03-15 09:05  cjweffort  阅读(135)  评论(0编辑  收藏  举报