标签:
Description
Input
Output
Sample Input
Sample Output
#include <iostream> #include <cstdio> #include <cstring> using namespace std; struct dangchi { char str[20]; int sum; }; int main() { #ifdef CDZSC_OFFLINE freopen("in.txt","r",stdin); #endif int n,a,b,sum; while(scanf("%d",&n)&&n!=0) { b=0,sum=0; while(n--) { scanf("%d",&a); if(a>b) { sum+=(a-b)*6+5; b=a; } else if(a<b) { sum+=(b-a)*4+5; b=a; } else { sum+=5; } } printf("%d\n",sum); } return 0; }
标签:
原文地址:http://www.cnblogs.com/Wing0624/p/4243800.html