1008 Elevator (20point(s)) Easy only once

基本思想:

弱智题,相邻计算可破;

 

关键点:

无;

 

#include
#include
#include
#include 
#include
#include
#include
#include
using namespace std;
using std::vector;


int main() {
	int n, las;
	las = 0;
	int cnt = 0;
	scanf("%d", &n);
	int now;
	for (int i = 0; i < n; i++) {
		scanf("%d",&now);
		int flow = now - las;
		if (flow >= 0) {
			cnt += flow * 6 + 5;
		}
		else {
			cnt += abs(flow) * 4 + 5;
		}
		las = now;
	}
	cout << cnt;
	system("pause");
	return 0;
}

  

你可能感兴趣的:(1008 Elevator (20point(s)) Easy only once)