HDOJ-1008 Elevator

http://acm.hdu.edu.cn/showproblem.php?pid=1008

//模拟 无亮点

# include <stdio.h>



int main()

{

	int n;

	while(scanf("%d",&n) && n)

	{

		int Target, Last = 0, Time = 0;

		for(int i = 1; i <= n; i++)

		{

			scanf("%d",&Target);



			if(Target > Last)

				Time += (Target - Last) * 6 + 5;

			else

				Time += (Last - Target) * 4 + 5;



			Last = Target;

		}

		printf("%d\n",Time);

	}



	return 0;

}

  

你可能感兴趣的:(EL)