hdu 1008(简单数学)

//简单数学题
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
int n;
while (scanf("%d", &n), n) {
int time = 0;
int one, two;
one = 0;
for (int i=0; i<n; ++i) {
scanf ("%d", &two);
if (one < two) time += (two - one) * 6;
else time += (one - two) * 4;
one = two;
}
time += n * 5;
printf ("%d\n", time);
}
return 0;
}

 

你可能感兴趣的:(HDU)