注意点:
1.
电梯从0层开始,上6下4停5
2.坑
第一个数据是测试用例数量,姥姥没有加换行符,导致我想了半天测试用例的41是怎么得到的。
3.
每个数据都要加上停靠时间,包括最后一个数。
// 6*2+5 + 6*1+5 + 4*2+5=17+11+13=41
#include <bits/stdc++.h>
using namespace std;
int main()
{
// freopen("in.txt", "rt", stdin);
// freopen("out.txt", "wt", stdout);
int n, last = 0, now, ans = 0;
cin >> n;
while (n--)
{
cin >> now;
if (now > last)
{
ans += (now - last) * 6 + 5;
}
else
{
ans += (last - now) * 4 + 5;
}
last = now;
}
cout << ans;
}