1008 Elevator (20point(s)) Easy only once
基本思想:
弱智题,相邻计算可破;
关键点:
无;
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
#include<vector>
#include<string>
#include<math.h>
#include<algorithm>
#include<cstring>
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;
}

浙公网安备 33010602011771号