题1008

版权声明:// Copyright © 2018年 Coding18. All rights reserved. https://blog.csdn.net/Coding18/article/details/85912228
#include <cstdio>
#include <algorithm>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	int temp = 0,k,t,sum = 0;
	for(int i = 0; i < n; i++){
		scanf("%d",&k);
		t = k - temp;
		sum += 5;
		if(t > 0) sum += 6 * t;
		if(t < 0) sum += 4 *(-t);
		temp = k;
	}
	printf("%d",sum);
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/Coding18/article/details/85912228
今日推荐