标签:
题解:简单模拟题。
#include<iostream> #include<stdio.h> #include<algorithm> using namespace std; int main() { int n; while(cin>> n && n){ int sum = 0; int pre = 0, x; for(int i=0; i<n; i++){ cin>>x; if(x -pre>0){ //up sum += (x-pre)*6; }else{ //down sum += (pre-x)*4; } sum+=5; pre =x; } cout<<sum<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/lzeffort/p/5905905.html