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

如题。。。

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

时间: 2024-10-16 04:00:17

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

1008. Elevator (20)——PAT (Advanced Level) Practise

题目信息: 1008. Elevator (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator w

[PTA] PAT(A) 1008 Elevator (20 分)

目录 Problem Description Input Output Sample Sample Input Sample Output Solution Analysis Code Problem portal: 1008 Elevator (20 分) Description  The highest building in our city has only one elevator. A request list is made up with $N$ positive numbers

Programming Ability Test学习 1008. Elevator (20)

1008. Elevator (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will st

1008 Elevator (20分)

1008 Elevator (20分) 题目: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator

【PAT甲级】1008 Elevator (20分)

1008 Elevator 题目: The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one

PAT甲题题解-1035. Password (20)-水

题意:给n个用户名和密码,把密码中的1改为@,0改为%,l改为L,O改为o. 让你输出需要修改密码的用户名个数,以及对应的用户名和密码,按输入的顺序.如果没有用户需要修改,则输出对应的语句,注意单复数... 没啥好说的,就for一遍密码,把需要改的改下,存入到ans中去. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cm

PAT甲题题解-1077. Kuchiguse (20)-找相同后缀

#include <iostream> #include <cstdio> #include <algorithm> #include <string.h> #include <cmath> using namespace std; /* 找最长相同后缀 */ const int maxn=105; char str[maxn][300]; char ans[300]; int len[maxn]; int main() { int n; int

1008. Elevator (20)(模拟题)

The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seco

PAT 1008 Elevator (20)

The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seco