PAT甲题题解-1008. Elevator (20)-大么个大水题,这也太小瞧我们做题者的智商了

时间:2023-02-13 04:53:05

如题。。。

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string.h>
using namespace std;
//太水了好吧。。。
int n;
int timeup=;
int timedown=;
int main()
{
scanf("%d",&n);
int last=;
int now;
int sum=;
for(int i=;i<n;i++){
scanf("%d",&now);
sum+=((now-last)>=)?(now-last)*timeup:(last-now)*timedown;
last=now;
}
printf("%d",sum+n*);
return ;
}