题解:简单模拟题。

#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;
    }

  

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2021-08-24
  • 2022-12-23
  • 2021-06-29
  • 2022-01-17
  • 2022-01-16
  • 2021-07-14
猜你喜欢
  • 2022-02-12
  • 2021-05-21
  • 2022-12-23
  • 2021-12-21
  • 2022-01-25
相关资源
相似解决方案