HDU1008

 //import java.text.DecimalFormat;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

while(sc.hasNext()){

int n=sc.nextInt();
if(n==0)System.exit(0);
int pre=0;
int total=0;
for(int i=1;i<=n;i++)
{int num=sc.nextInt();
if(num>pre){total+=6*(num-pre)+5;pre=num;}
else if(num else total+=5;
}
System.out.println(total);
}
}

}


你可能感兴趣的:(HDU1008)